summaryrefslogtreecommitdiff
path: root/cli/lsp/analysis.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2024-08-14 22:38:18 +0100
committerGitHub <noreply@github.com>2024-08-14 22:38:18 +0100
commit4eff1e8ec4c12c709ce7e0e6d430ecbbc571bfbe (patch)
tree88c3bae373e03e20ca251b7eb91b5c1fa53d5b20 /cli/lsp/analysis.rs
parent3a3315cc7f3466ce229f6f150402d5ccf72b3d1d (diff)
fix(lsp): import map lookup for jsr subpath auto import (#25025)
Diffstat (limited to 'cli/lsp/analysis.rs')
-rw-r--r--cli/lsp/analysis.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs
index ec8bd4a28..9f2c7ffc8 100644
--- a/cli/lsp/analysis.rs
+++ b/cli/lsp/analysis.rs
@@ -312,6 +312,16 @@ impl<'a> TsResponseImportMapper<'a> {
if let Some(result) = import_map.lookup(&specifier, referrer) {
return Some(result);
}
+ if let Some(req_ref_str) = specifier.as_str().strip_prefix("jsr:") {
+ if !req_ref_str.starts_with('/') {
+ let specifier_str = format!("jsr:/{req_ref_str}");
+ if let Ok(specifier) = ModuleSpecifier::parse(&specifier_str) {
+ if let Some(result) = import_map.lookup(&specifier, referrer) {
+ return Some(result);
+ }
+ }
+ }
+ }
}
return Some(spec_str);
}