diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs index a04f490f70..fb998f8804 100644 --- a/cli/lsp/diagnostics.rs +++ b/cli/lsp/diagnostics.rs @@ -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, diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 4bc4713c6b..567af53999 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -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] } ],