3 ms·
If you think lsp-mode is too slow you can simulate „jump to definition“ using old-school „xref“ and „etags“ that comes with your Emacs. It creates a reverse ind
by G3rn0ti 4y ago
If you think lsp-mode is too slow you can simulate „jump to definition“ using old-school „xref“ and „etags“ that comes with your Emacs. It creates a reverse index for you. Then you can put that in your git repo and add it to your .gitignore.
Finally, you can press „M-.“ for jump to definition and return to your buffer pressing „M-,“ — if the name of the function is unique. In practice, that works good enough most of the time.
„etags“ runs so quickly you can call it from a git hook and re-generate the reverse index every time you pull or check out a branch.
It works with all languages. No lsp server required.
- marcosdumay 4y agoDoesn't the language server lisps provide that? (I'm postponing installing and learning to use any for years...)
- G3rn0ti 4y agoYes, language servers provide that feature, too, and all language server clients replace „xref“ with their own implementation. „lsp-mode“ even provide some gui extensions to Emacs so it can display a hover window when there are several possible matches for your definition (e.g. all overridden methods in your inheritance tree). That’s quite cool. But the disadvantage is you now need to run a static analyzer in the background parsing half of your code base to find definitions. On very large code based this can create slow downs. Furthermore, finding definitions by means of static analysis cannot always work, especially so in dynamically typed languages or in languages employing generic variables.