diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-05-13 17:55:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-13 17:55:31 +0100 |
commit | 88529f0b47667435689c6ef4f81af80cead7d557 (patch) | |
tree | be0ebfec30659e4f2c95a4a399072285a40245a4 /cli/graph_util.rs | |
parent | 03a76f33ad0808c659116721a757958ad054dd25 (diff) |
refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764)
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r-- | cli/graph_util.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs index ac7f8a365..375096f98 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -65,7 +65,7 @@ pub struct GraphValidOptions { /// for the CLI. pub fn graph_valid( graph: &ModuleGraph, - fs: &dyn FileSystem, + fs: Arc<dyn FileSystem>, roots: &[ModuleSpecifier], options: GraphValidOptions, ) -> Result<(), AnyError> { @@ -99,7 +99,7 @@ pub fn graph_valid( ) } ModuleGraphError::ModuleError(e) => { - enhanced_module_error_message(fs, e) + enhanced_module_error_message(fs.clone(), e) } }; @@ -661,7 +661,7 @@ impl ModuleGraphBuilder { ) -> Result<(), AnyError> { graph_valid( graph, - self.fs.as_ref(), + self.fs.clone(), roots, GraphValidOptions { is_vendoring: false, @@ -705,14 +705,13 @@ pub fn enhanced_resolution_error_message(error: &ResolutionError) -> String { } pub fn enhanced_module_error_message( - fs: &dyn FileSystem, + fs: Arc<dyn FileSystem>, error: &ModuleError, ) -> String { let additional_message = match error { ModuleError::LoadingErr(specifier, _, _) // ex. "Is a directory" error | ModuleError::Missing(specifier, _) => { - SloppyImportsResolver::resolve_with_fs( - fs, + SloppyImportsResolver::new(fs).resolve( specifier, ResolutionMode::Execution, ) |