diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-08-17 12:14:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-17 16:14:22 +0000 |
commit | f343391a9f97d29ad287f247c06aa370eb7cab50 (patch) | |
tree | eeed398c9506fde5c20d3e552edd8a432bc5a2ae /cli/lsp/documents.rs | |
parent | 6082e51094e0b5835d7c83586766cc611da2a382 (diff) |
fix(unstable): disable importing from the vendor directory (#20067)
Some people might get think they need to import from this directory,
which could cause confusion and duplicate dependencies. Additionally,
the `vendor` directory has special behaviour in the language server, so
importing from the folder will definitely cause confusion and issues
there.
Diffstat (limited to 'cli/lsp/documents.rs')
-rw-r--r-- | cli/lsp/documents.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 439cf547d..8227d2e4c 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -21,6 +21,7 @@ use crate::npm::CliNpmRegistryApi; use crate::npm::NpmResolution; use crate::npm::PackageJsonDepsInstaller; use crate::resolver::CliGraphResolver; +use crate::resolver::CliGraphResolverOptions; use crate::util::glob; use crate::util::path::specifier_to_file_path; use crate::util::text_encoding; @@ -1241,13 +1242,19 @@ impl Documents { Arc::new(PackageJsonDepsProvider::new(maybe_package_json_deps)); let deps_installer = Arc::new(PackageJsonDepsInstaller::no_op()); self.resolver = Arc::new(CliGraphResolver::new( - maybe_jsx_config, - options.maybe_import_map, - false, options.npm_registry_api, options.npm_resolution, deps_provider, deps_installer, + CliGraphResolverOptions { + maybe_jsx_import_source_config: maybe_jsx_config, + maybe_import_map: options.maybe_import_map, + maybe_vendor_dir: options + .maybe_config_file + .and_then(|c| c.vendor_dir_path()) + .as_ref(), + no_npm: false, + }, )); self.imports = Arc::new( if let Some(Ok(imports)) = |