summaryrefslogtreecommitdiff
path: root/cli/lsp/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp/diagnostics.rs')
-rw-r--r--cli/lsp/diagnostics.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs
index 9ec273d7f..cb368b1f2 100644
--- a/cli/lsp/diagnostics.rs
+++ b/cli/lsp/diagnostics.rs
@@ -1236,10 +1236,14 @@ fn diagnose_resolution(
} else if let Ok(pkg_ref) =
NpmPackageReqReference::from_specifier(specifier)
{
- if let Some(npm) = &snapshot.npm {
+ if let Some(npm_resolver) = snapshot
+ .npm
+ .as_ref()
+ .and_then(|n| n.npm_resolver.as_managed())
+ {
// show diagnostics for npm package references that aren't cached
let req = pkg_ref.into_inner().req;
- if !npm.npm_resolver.is_pkg_req_folder_cached(&req) {
+ if !npm_resolver.is_pkg_req_folder_cached(&req) {
diagnostics
.push(DenoDiagnostic::NoCacheNpm(req, specifier.clone()));
}
@@ -1249,10 +1253,14 @@ fn diagnose_resolution(
if !deno_node::is_builtin_node_module(module_name) {
diagnostics
.push(DenoDiagnostic::InvalidNodeSpecifier(specifier.clone()));
- } else if let Some(npm) = &snapshot.npm {
+ } else if let Some(npm_resolver) = snapshot
+ .npm
+ .as_ref()
+ .and_then(|n| n.npm_resolver.as_managed())
+ {
// check that a @types/node package exists in the resolver
let types_node_req = PackageReq::from_str("@types/node").unwrap();
- if !npm.npm_resolver.is_pkg_req_folder_cached(&types_node_req) {
+ if !npm_resolver.is_pkg_req_folder_cached(&types_node_req) {
diagnostics.push(DenoDiagnostic::NoCacheNpm(
types_node_req,
ModuleSpecifier::parse("npm:@types/node").unwrap(),