diff options
Diffstat (limited to 'cli/lsp')
-rw-r--r-- | cli/lsp/code_lens.rs | 12 | ||||
-rw-r--r-- | cli/lsp/documents.rs | 6 | ||||
-rw-r--r-- | cli/lsp/testing/collectors.rs | 12 |
3 files changed, 17 insertions, 13 deletions
diff --git a/cli/lsp/code_lens.rs b/cli/lsp/code_lens.rs index d64b2014f..cab7af1a6 100644 --- a/cli/lsp/code_lens.rs +++ b/cli/lsp/code_lens.rs @@ -153,9 +153,9 @@ impl Visit for DenoTestCollector { } ast::Expr::Member(member_expr) => { if let ast::MemberProp::Ident(ns_prop_ident) = &member_expr.prop { - if ns_prop_ident.sym.to_string() == "test" { + if ns_prop_ident.sym == "test" { if let ast::Expr::Ident(ident) = member_expr.obj.as_ref() { - if ident.sym.to_string() == "Deno" { + if ident.sym == "Deno" { self.check_call_expr(node, &ns_prop_ident.range()); } } @@ -173,7 +173,7 @@ impl Visit for DenoTestCollector { match init.as_ref() { // Identify destructured assignments of `test` from `Deno` ast::Expr::Ident(ident) => { - if ident.sym.to_string() == "Deno" { + if ident.sym == "Deno" { if let ast::Pat::Object(object_pat) = &decl.name { for prop in &object_pat.props { match prop { @@ -185,7 +185,7 @@ impl Visit for DenoTestCollector { } ast::ObjectPatProp::KeyValue(prop) => { if let ast::PropName::Ident(key_ident) = &prop.key { - if key_ident.sym.to_string() == "test" { + if key_ident.sym == "test" { if let ast::Pat::Ident(value_ident) = &prop.value.as_ref() { @@ -205,9 +205,9 @@ impl Visit for DenoTestCollector { // Identify variable assignments where the init is `Deno.test` ast::Expr::Member(member_expr) => { if let ast::Expr::Ident(obj_ident) = member_expr.obj.as_ref() { - if obj_ident.sym.to_string() == "Deno" { + if obj_ident.sym == "Deno" { if let ast::MemberProp::Ident(prop_ident) = &member_expr.prop { - if prop_ident.sym.to_string() == "test" { + if prop_ident.sym == "test" { if let ast::Pat::Ident(binding_ident) = &decl.name { self.test_vars.insert(binding_ident.id.sym.to_string()); } diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 674540281..bab94080f 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -34,6 +34,7 @@ use deno_core::futures::FutureExt; use deno_core::parking_lot::Mutex; use deno_core::url; use deno_core::ModuleSpecifier; +use deno_graph::source::ResolutionMode; use deno_graph::GraphImport; use deno_graph::Resolution; use deno_runtime::deno_node; @@ -1073,7 +1074,10 @@ impl Documents { specifier: &str, referrer: &ModuleSpecifier, ) -> bool { - let maybe_specifier = self.get_resolver().resolve(specifier, referrer).ok(); + let maybe_specifier = self + .get_resolver() + .resolve(specifier, referrer, ResolutionMode::Types) + .ok(); if let Some(import_specifier) = maybe_specifier { self.exists(&import_specifier) } else { diff --git a/cli/lsp/testing/collectors.rs b/cli/lsp/testing/collectors.rs index bc8eb65f1..e4538ab9d 100644 --- a/cli/lsp/testing/collectors.rs +++ b/cli/lsp/testing/collectors.rs @@ -479,12 +479,12 @@ impl Visit for TestCollector { ns_prop_ident: &ast::Ident, member_expr: &ast::MemberExpr, ) { - if ns_prop_ident.sym.to_string() == "test" { + if ns_prop_ident.sym == "test" { let ast::Expr::Ident(ident) = member_expr.obj.as_ref() else { return; }; - if ident.sym.to_string() != "Deno" { + if ident.sym != "Deno" { return; } @@ -563,7 +563,7 @@ impl Visit for TestCollector { match init.as_ref() { // Identify destructured assignments of `test` from `Deno` ast::Expr::Ident(ident) => { - if ident.sym.to_string() != "Deno" { + if ident.sym != "Deno" { continue; } @@ -584,7 +584,7 @@ impl Visit for TestCollector { continue; }; - if key_ident.sym.to_string() == "test" { + if key_ident.sym == "test" { if let ast::Pat::Ident(value_ident) = &prop.value.as_ref() { self.vars.insert(value_ident.id.sym.to_string()); } @@ -600,7 +600,7 @@ impl Visit for TestCollector { continue; }; - if obj_ident.sym.to_string() != "Deno" { + if obj_ident.sym != "Deno" { continue; }; @@ -608,7 +608,7 @@ impl Visit for TestCollector { continue; }; - if prop_ident.sym.to_string() != "test" { + if prop_ident.sym != "test" { continue; } |