diff options
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r-- | cli/lsp/tsc.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index 9a8dc7b21..8fc429d9d 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -496,8 +496,16 @@ impl DocumentSpan { self.text_span.to_range(&target_line_index), ) }; + let origin_selection_range = + if let Some(original_context_span) = &self.original_context_span { + Some(original_context_span.to_range(line_index)) + } else if let Some(original_text_span) = &self.original_text_span { + Some(original_text_span.to_range(line_index)) + } else { + None + }; let link = lsp::LocationLink { - origin_selection_range: Some(self.text_span.to_range(line_index)), + origin_selection_range, target_uri, target_range, target_selection_range, @@ -589,6 +597,17 @@ impl ImplementationLocation { range: self.document_span.text_span.to_range(line_index), } } + + pub(crate) async fn to_link( + &self, + line_index: &LineIndex, + language_server: &mut language_server::Inner, + ) -> Option<lsp::LocationLink> { + self + .document_span + .to_link(line_index, language_server) + .await + } } #[derive(Debug, Deserialize)] |