From 88529f0b47667435689c6ef4f81af80cead7d557 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Mon, 13 May 2024 17:55:31 +0100 Subject: refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764) --- cli/graph_util.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'cli/graph_util.rs') 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, 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, 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, ) -- cgit v1.2.3