LSP, or Language Server Protocol, makes programming easier by introducing features like more precise auto-completion and definition lookup. It may have scratched your itches, and you are wondering what the experience is like in Emacs.
Emacs has mainly two LSP clients out there, eglot and lsp-mode. Eglot is lightweight, and it could almost run out of the box. So in this post I will briefly show you how to use eglot.
As a user, we only need to know these commands to get started:
M-x eglot connects to an LSP server for the current project
M-x flymake-goto-next-error goes to previous error in the current buffer
M-x flymake-goto-prev-error goes to next error in the current buffer
M-. or M-x xref-find-definitions finds the definition of the symbol at point and opens it in the current window
M-, or M-x xref-pop-marker-stack jumps back
M-? or M-x xref-find-references finds the references of the symbol at point
Occasionally, we may need:
M-x company-complete to trigger completions manually
M-x eldoc-doc-buffer to show docs for the symbol at point in a dedicated buffer
I've also made a video to demonstrate the workflow as below:
And, the emacs-showcase.el is following for the video: