diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-02-18 14:15:13 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-18 14:15:13 +1100 |
commit | 78e34d49120d8cc2583d8d6d28ae9b74f9765533 (patch) | |
tree | 004474a219c150f27471daa9300cbd3898e0a031 /cli/lsp/tsc.rs | |
parent | c7dabc99eed50fa20cdcafd7c0175ab615da3d50 (diff) |
fix(lsp): document spans use original range (#9525)
Fixes: #9444
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
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)] |