Skip to content

Commit

Permalink
fix(lsp): show related information for tsc diagnostics (denoland#20654)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn authored Sep 24, 2023
1 parent b5ba5f1 commit d955d66
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cli/lsp/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,10 @@ fn to_lsp_related_information(
related
.iter()
.filter_map(|ri| {
if let (Some(source), Some(start), Some(end)) =
(&ri.source, &ri.start, &ri.end)
if let (Some(file_name), Some(start), Some(end)) =
(&ri.file_name, &ri.start, &ri.end)
{
let uri = lsp::Url::parse(source).unwrap();
let uri = lsp::Url::parse(file_name).unwrap();
Some(lsp::DiagnosticRelatedInformation {
location: lsp::Location {
uri,
Expand Down
19 changes: 18 additions & 1 deletion cli/tests/integration/lsp_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7351,7 +7351,24 @@ fn lsp_diagnostics_deprecated() {
"code": 6385,
"source": "deno-ts",
"message": "'a' is deprecated.",
"relatedInformation": [],
"relatedInformation": [
{
"location": {
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 0,
"character": 4,
},
"end": {
"line": 0,
"character": 16,
},
},
},
"message": "The declaration was marked as deprecated here.",
},
],
"tags": [2]
}
],
Expand Down

0 comments on commit d955d66

Please sign in to comment.