JunoLab / atom-ink

IDE toolkit for Atom
MIT License
228 stars 40 forks source link

add return-from-goto command #170

Closed ssfrr closed 5 years ago

ssfrr commented 5 years ago

I just discovered the goto-symbol functionality, which is super nice. One thing I'm missing from previous experience with ctags in vim is a quick way to return to where I came from. It's pretty common for me to want to pop into a definition and then pop back out quickly.

pfitzseb commented 5 years ago

What's the desired behaviour here, i.e. which of the following to we want to keep track of:

  1. changed file
  2. changed line/file with go-to-symbol
  3. changed line/file when clicking on a link or calling @edit etc.
  4. changed pane/pane item focus (so that you can switch back to e.g. the repl or workspace or whatever)
ssfrr commented 5 years ago

If I’m understanding correctly I’m focusing on 2. 3 would be cool as well but it seems like it might be harder to catch a call to @edit, and there isn’t a well-defined cursor position to return to if there’s no file in focus because you’re typing it into the REPL.

The idea would be that every time go-to-symbol is invoked it would push the cursor position to a stack, and then return-from-goto would pop from that stack and jump you back where you came from. This would make it really quick to trace through code.

pfitzseb commented 5 years ago

Makes sense. I tried implementing this over the weekend with all four options, but that didn't feel great (and meant that there's lots of weird heuristics necessary to collapse e.g. the event emitted from changing to a file and from going to a line in a file etc).

Implementing 3 is fairly trivial, but I'm not sure if we'd even want that -- suppose you click on a profile frame: Would you want to have that in your "navigation history"?