diff options
Diffstat (limited to 'cli/lsp')
| -rw-r--r-- | cli/lsp/config.rs | 14 | ||||
| -rw-r--r-- | cli/lsp/documents.rs | 6 | ||||
| -rw-r--r-- | cli/lsp/language_server.rs | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index b84f63edc..13bfdd75d 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -475,10 +475,8 @@ impl Config { .and_then(|p| p.maybe_node_modules_dir.as_ref()) } - pub fn maybe_deno_modules_dir_path(&self) -> Option<PathBuf> { - self - .maybe_config_file() - .and_then(|c| c.deno_modules_dir_path()) + pub fn maybe_vendor_dir_path(&self) -> Option<PathBuf> { + self.maybe_config_file().and_then(|c| c.vendor_dir_path()) } pub fn maybe_config_file(&self) -> Option<&ConfigFile> { @@ -816,7 +814,13 @@ fn resolve_node_modules_dir(config_file: &ConfigFile) -> Option<PathBuf> { // `nodeModulesDir: true` setting in the deno.json file. This is to // reduce the chance of modifying someone's node_modules directory // without them having asked us to do so. - if config_file.node_modules_dir() != Some(true) { + let explicitly_disabled = config_file.node_modules_dir_flag() == Some(false); + if explicitly_disabled { + return None; + } + let enabled = config_file.node_modules_dir_flag() == Some(true) + || config_file.vendor_dir_flag() == Some(true); + if !enabled { return None; } if config_file.specifier.scheme() != "file" { diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index dbaecb95c..7fdce9923 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -1184,7 +1184,7 @@ impl Documents { document_preload_limit: usize, maybe_import_map: Option<&import_map::ImportMap>, maybe_jsx_config: Option<&JsxImportSourceConfig>, - maybe_deno_modules_dir: Option<bool>, + maybe_vendor_dir: Option<bool>, maybe_package_json_deps: Option<&PackageJsonDeps>, ) -> u64 { let mut hasher = FastInsecureHasher::default(); @@ -1199,7 +1199,7 @@ impl Documents { hasher.write_str(&import_map.to_json()); hasher.write_str(import_map.base_url().as_str()); } - hasher.write_hashable(maybe_deno_modules_dir); + hasher.write_hashable(maybe_vendor_dir); hasher.write_hashable(maybe_jsx_config); if let Some(package_json_deps) = &maybe_package_json_deps { // We need to ensure the hashing is deterministic so explicitly type @@ -1234,7 +1234,7 @@ impl Documents { options.document_preload_limit, options.maybe_import_map.as_deref(), maybe_jsx_config.as_ref(), - options.maybe_config_file.and_then(|c| c.deno_modules_dir()), + options.maybe_config_file.and_then(|c| c.vendor_dir_flag()), maybe_package_json_deps.as_ref(), ); let deps_provider = diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 06fefcaeb..7a13e2396 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -906,7 +906,7 @@ impl Inner { // update the cache path let global_cache = Arc::new(GlobalHttpCache::new(dir.deps_folder_path())); let maybe_local_cache = - self.config.maybe_deno_modules_dir_path().map(|local_path| { + self.config.maybe_vendor_dir_path().map(|local_path| { Arc::new(LocalLspHttpCache::new(local_path, global_cache.clone())) }); let cache: Arc<dyn HttpCache> = maybe_local_cache |
