aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorJan Hrastnik2021-03-02 22:57:18 +0000
committerBlaž Hrastnik2021-03-16 14:03:10 +0000
commitb738ae1bc7f42ce6756ee5d79307e416f86ef491 (patch)
tree39dc024b61eb1f99ec660d0b7131f4df41119e83 /helix-term
parent294791dffd707d0725db5eb35b5165fd1bb2c24a (diff)
more goto lsp functions
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index f07a3933..9b48e803 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -872,11 +872,19 @@ pub fn goto_definition(cx: &mut Context) {
doc.mode = Mode::Normal;
+ log::info!("{:?}", res);
+ let filepath = doc.path.clone().unwrap();
+ log::info!("{:?}", filepath);
+
match &res.as_slice() {
[location] => {
- let definition_pos = location.range.start;
- let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text().slice(..), definition_pos);
- doc.set_selection(Selection::point(new_pos));
+ if filepath.to_str().unwrap() == location.uri.path() {
+ let definition_pos = location.range.start;
+ let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text().slice(..), definition_pos);
+ doc.set_selection(Selection::point(new_pos));
+ } else {
+ // open new file
+ }
}
[] => (), // maybe show user message that no definition was found?
_ => {