diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-10-01 22:55:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-01 22:55:02 +0100 |
commit | 3881b7173445ab7f68ec94d5dedbb1cb1c1978ec (patch) | |
tree | 2683c9955f19c9e1d19af6a41ce75cab5b3570fa /cli/lsp/diagnostics.rs | |
parent | f9300004152ba4b3d091beb04d74f37b3b8ec281 (diff) |
feat(lsp): quick fix for @deno-types="npm:@types/*" (#25954)
Diffstat (limited to 'cli/lsp/diagnostics.rs')
-rw-r--r-- | cli/lsp/diagnostics.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs index e57681f3f..caabd3f04 100644 --- a/cli/lsp/diagnostics.rs +++ b/cli/lsp/diagnostics.rs @@ -1517,17 +1517,19 @@ fn diagnose_dependency( let import_ranges: Vec<_> = dependency .imports .iter() - .map(|i| documents::to_lsp_range(&i.range)) + .map(|i| documents::to_lsp_range(&i.specifier_range)) .collect(); // TODO(nayeemrmn): This is a crude way of detecting `@deno-types` which has // a different specifier and therefore needs a separate call to // `diagnose_resolution()`. It would be much cleaner if that were modelled as // a separate dependency: https://github.com/denoland/deno_graph/issues/247. let is_types_deno_types = !dependency.maybe_type.is_none() - && !dependency - .imports - .iter() - .any(|i| dependency.maybe_type.includes(&i.range.start).is_some()); + && !dependency.imports.iter().any(|i| { + dependency + .maybe_type + .includes(&i.specifier_range.start) + .is_some() + }); diagnostics.extend( diagnose_resolution( |