From b5f032df73bd5de78be53f002b9bef048cf59f44 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 29 Aug 2023 16:22:05 +0100 Subject: feat(lsp): npm specifier completions (#20121) --- cli/lsp/language_server.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cli/lsp/language_server.rs') diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 6c828ba3d..9c1f4ee7a 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -59,6 +59,7 @@ use super::documents::UpdateDocumentConfigOptions; use super::logging::lsp_log; use super::logging::lsp_warn; use super::lsp_custom; +use super::npm::CliNpmSearchApi; use super::parent_process_checker; use super::performance::Performance; use super::performance::PerformanceMark; @@ -123,6 +124,8 @@ struct LspNpmServices { config_hash: LspNpmConfigHash, /// Npm's registry api. api: Arc, + /// Npm's search api. + search_api: CliNpmSearchApi, /// Npm cache cache: Arc, /// Npm resolution that is stored in memory. @@ -556,6 +559,8 @@ impl Inner { module_registries_location.clone(), http_client.clone(), ); + let npm_search_api = + CliNpmSearchApi::new(module_registries.file_fetcher.clone(), None); let location = dir.deps_folder_path(); let deps_http_cache = Arc::new(GlobalHttpCache::new( location, @@ -612,6 +617,7 @@ impl Inner { npm: LspNpmServices { config_hash: LspNpmConfigHash(0), // this will be updated in initialize api: npm_api, + search_api: npm_search_api, cache: npm_cache, resolution: npm_resolution, resolver: npm_resolver, @@ -2345,6 +2351,7 @@ impl Inner { &self.config.snapshot(), &self.client, &self.module_registries, + &self.npm.search_api, &self.documents, self.maybe_import_map.clone(), ) -- cgit v1.2.3