summaryrefslogtreecommitdiff
path: root/cli/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp')
-rw-r--r--cli/lsp/completions.rs10
-rw-r--r--cli/lsp/diagnostics.rs14
-rw-r--r--cli/lsp/documents.rs6
-rw-r--r--cli/lsp/language_server.rs10
-rw-r--r--cli/lsp/registries.rs5
-rw-r--r--cli/lsp/tsc.rs11
6 files changed, 43 insertions, 13 deletions
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs
index a895239a6..60244f2e4 100644
--- a/cli/lsp/completions.rs
+++ b/cli/lsp/completions.rs
@@ -520,14 +520,20 @@ mod tests {
source_fixtures: &[(&str, &str)],
location: &Path,
) -> Documents {
- let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
+ let cache = Arc::new(GlobalHttpCache::new(
+ location.to_path_buf(),
+ crate::cache::RealDenoCacheEnv,
+ ));
let mut documents = Documents::new(cache);
for (specifier, source, version, language_id) in fixtures {
let specifier =
resolve_url(specifier).expect("failed to create specifier");
documents.open(specifier, *version, *language_id, (*source).into());
}
- let http_cache = GlobalHttpCache::new(location.to_path_buf());
+ let http_cache = GlobalHttpCache::new(
+ location.to_path_buf(),
+ crate::cache::RealDenoCacheEnv,
+ );
for (specifier, source) in source_fixtures {
let specifier =
resolve_url(specifier).expect("failed to create specifier");
diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs
index 88c4c91cb..4e24673f3 100644
--- a/cli/lsp/diagnostics.rs
+++ b/cli/lsp/diagnostics.rs
@@ -1331,6 +1331,7 @@ fn generate_deno_diagnostics(
mod tests {
use super::*;
use crate::cache::GlobalHttpCache;
+ use crate::cache::RealDenoCacheEnv;
use crate::lsp::config::ConfigSnapshot;
use crate::lsp::config::Settings;
use crate::lsp::config::SpecifierSettings;
@@ -1349,7 +1350,10 @@ mod tests {
location: &Path,
maybe_import_map: Option<(&str, &str)>,
) -> StateSnapshot {
- let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
+ let cache = Arc::new(GlobalHttpCache::new(
+ location.to_path_buf(),
+ RealDenoCacheEnv,
+ ));
let mut documents = Documents::new(cache);
for (specifier, source, version, language_id) in fixtures {
let specifier =
@@ -1374,7 +1378,7 @@ mod tests {
maybe_import_map,
assets: Default::default(),
cache_metadata: cache::CacheMetadata::new(Arc::new(
- GlobalHttpCache::new(location.to_path_buf()),
+ GlobalHttpCache::new(location.to_path_buf(), RealDenoCacheEnv),
)),
maybe_node_resolver: None,
maybe_npm_resolver: None,
@@ -1424,7 +1428,8 @@ let c: number = "a";
None,
);
let snapshot = Arc::new(snapshot);
- let cache = Arc::new(GlobalHttpCache::new(cache_location));
+ let cache =
+ Arc::new(GlobalHttpCache::new(cache_location, RealDenoCacheEnv));
let ts_server = TsServer::new(Default::default(), cache);
// test enabled
@@ -1517,7 +1522,8 @@ let c: number = "a";
None,
);
let snapshot = Arc::new(snapshot);
- let cache = Arc::new(GlobalHttpCache::new(cache_location));
+ let cache =
+ Arc::new(GlobalHttpCache::new(cache_location, RealDenoCacheEnv));
let ts_server = TsServer::new(Default::default(), cache);
let config = mock_config();
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs
index 7fdce9923..439cf547d 100644
--- a/cli/lsp/documents.rs
+++ b/cli/lsp/documents.rs
@@ -1851,6 +1851,7 @@ fn sort_and_remove_non_leaf_dirs(mut dirs: Vec<PathBuf>) -> Vec<PathBuf> {
#[cfg(test)]
mod tests {
use crate::cache::GlobalHttpCache;
+ use crate::cache::RealDenoCacheEnv;
use crate::npm::NpmResolution;
use super::*;
@@ -1861,7 +1862,10 @@ mod tests {
fn setup(temp_dir: &TempDir) -> (Documents, PathRef) {
let location = temp_dir.path().join("deps");
- let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
+ let cache = Arc::new(GlobalHttpCache::new(
+ location.to_path_buf(),
+ RealDenoCacheEnv,
+ ));
let documents = Documents::new(cache);
(documents, location)
}
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index 7a13e2396..5b9ba94f1 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -555,7 +555,10 @@ impl Inner {
http_client.clone(),
);
let location = dir.deps_folder_path();
- let deps_http_cache = Arc::new(GlobalHttpCache::new(location));
+ let deps_http_cache = Arc::new(GlobalHttpCache::new(
+ location,
+ crate::cache::RealDenoCacheEnv,
+ ));
let documents = Documents::new(deps_http_cache.clone());
let cache_metadata = cache::CacheMetadata::new(deps_http_cache.clone());
let performance = Arc::new(Performance::default());
@@ -904,7 +907,10 @@ impl Inner {
);
self.module_registries_location = module_registries_location;
// update the cache path
- let global_cache = Arc::new(GlobalHttpCache::new(dir.deps_folder_path()));
+ let global_cache = Arc::new(GlobalHttpCache::new(
+ dir.deps_folder_path(),
+ crate::cache::RealDenoCacheEnv,
+ ));
let maybe_local_cache =
self.config.maybe_vendor_dir_path().map(|local_path| {
Arc::new(LocalLspHttpCache::new(local_path, global_cache.clone()))
diff --git a/cli/lsp/registries.rs b/cli/lsp/registries.rs
index 0219653bd..186db50b8 100644
--- a/cli/lsp/registries.rs
+++ b/cli/lsp/registries.rs
@@ -422,7 +422,10 @@ pub struct ModuleRegistry {
impl ModuleRegistry {
pub fn new(location: PathBuf, http_client: Arc<HttpClient>) -> Self {
// the http cache should always be the global one for registry completions
- let http_cache = Arc::new(GlobalHttpCache::new(location));
+ let http_cache = Arc::new(GlobalHttpCache::new(
+ location,
+ crate::cache::RealDenoCacheEnv,
+ ));
let mut file_fetcher = FileFetcher::new(
http_cache.clone(),
CacheSetting::RespectHeaders,
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 353866513..75ed8ebe3 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -3915,6 +3915,7 @@ mod tests {
use super::*;
use crate::cache::GlobalHttpCache;
use crate::cache::HttpCache;
+ use crate::cache::RealDenoCacheEnv;
use crate::http_util::HeadersMap;
use crate::lsp::cache::CacheMetadata;
use crate::lsp::config::WorkspaceSettings;
@@ -3931,7 +3932,10 @@ mod tests {
fixtures: &[(&str, &str, i32, LanguageId)],
location: &Path,
) -> StateSnapshot {
- let cache = Arc::new(GlobalHttpCache::new(location.to_path_buf()));
+ let cache = Arc::new(GlobalHttpCache::new(
+ location.to_path_buf(),
+ RealDenoCacheEnv,
+ ));
let mut documents = Documents::new(cache.clone());
for (specifier, source, version, language_id) in fixtures {
let specifier =
@@ -3960,7 +3964,8 @@ mod tests {
sources: &[(&str, &str, i32, LanguageId)],
) -> (JsRuntime, Arc<StateSnapshot>, PathBuf) {
let location = temp_dir.path().join("deps").to_path_buf();
- let cache = Arc::new(GlobalHttpCache::new(location.clone()));
+ let cache =
+ Arc::new(GlobalHttpCache::new(location.clone(), RealDenoCacheEnv));
let state_snapshot = Arc::new(mock_state_snapshot(sources, &location));
let mut runtime = js_runtime(Default::default(), cache);
start(&mut runtime, debug).unwrap();
@@ -4440,7 +4445,7 @@ mod tests {
LanguageId::TypeScript,
)],
);
- let cache = Arc::new(GlobalHttpCache::new(location));
+ let cache = Arc::new(GlobalHttpCache::new(location, RealDenoCacheEnv));
let specifier_dep =
resolve_url("https://deno.land/x/example/a.ts").unwrap();
cache