Closed meadofpoetry closed 8 months ago
Thank you very much for this!
I had in fact been working on the same functionality over the weekend, inspired by the Reddit discussion last week. I have pushed my solution to the branch "xref-backward". Please have a look.
Comparing our solutions, I prefer mine: I feel by using a CommandListener the plugin code is even simpler than your elegant solution, and I believe we would have less code to maintain. If you don't have any objections to this I could push my solution and make a new release with the new functionality very soon.
The one thing I see that you do that I didn't think of was to make sure we don't save duplicates into the history of positions, and I'd be happy to add that to my solution.
But have a look at both. I'd be interested in your opinion.
@strindberg Yes, apparently your solution is better and more integrated into existing GotoDeclaration functionality. Didn't know about commandlistener functionality. Will close this PR then.
There's now a released version of the plugin (1.3.0) with the new command.
This adds xref-go-forward/xref-go-back actions similar to those in Gnu/Emacs, which act as GotoDeclaration, but stores the position when Goto was called and allows to go back to it. The history is global instead of per-project, afaik it's default in Emacs.