diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-04-12 08:36:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 08:36:11 -0400 |
commit | 0e3f62d4446ae7b9a64dacf7befcaecede118222 (patch) | |
tree | fc1cbbbb294e61bb61e8d8ed89fa50cc9e9efa34 /cli/lsp/language_server.rs | |
parent | 806671af3345f403d122911d8a3f09a2994bb8c0 (diff) |
fix(npm): cache bust npm specifiers more aggressively (#18636)
Part 1: #18622
Part 2: This PR
Closes #16901
---------
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r-- | cli/lsp/language_server.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index c672f76f0..85bff7fbf 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -79,9 +79,9 @@ use crate::graph_util; use crate::http_util::HttpClient; use crate::lsp::urls::LspUrlKind; use crate::npm::create_npm_fs_resolver; +use crate::npm::CliNpmRegistryApi; use crate::npm::NpmCache; use crate::npm::NpmPackageResolver; -use crate::npm::NpmRegistry; use crate::npm::NpmResolution; use crate::proc_state::ProcState; use crate::tools::fmt::format_file; @@ -145,7 +145,7 @@ pub struct Inner { /// A lazily create "server" for handling test run requests. maybe_testing_server: Option<testing::TestServer>, /// Npm's registry api. - npm_api: NpmRegistry, + npm_api: CliNpmRegistryApi, /// Npm cache npm_cache: NpmCache, /// Npm resolution that is stored in memory. @@ -417,8 +417,13 @@ impl LanguageServer { fn create_lsp_structs( dir: &DenoDir, http_client: HttpClient, -) -> (NpmRegistry, NpmCache, NpmPackageResolver, NpmResolution) { - let registry_url = NpmRegistry::default_url(); +) -> ( + CliNpmRegistryApi, + NpmCache, + NpmPackageResolver, + NpmResolution, +) { + let registry_url = CliNpmRegistryApi::default_url(); let progress_bar = ProgressBar::new(ProgressBarStyle::TextOnly); let npm_cache = NpmCache::from_deno_dir( dir, @@ -430,7 +435,7 @@ fn create_lsp_structs( http_client.clone(), progress_bar.clone(), ); - let api = NpmRegistry::new( + let api = CliNpmRegistryApi::new( registry_url.clone(), npm_cache.clone(), http_client, |