Emacs-based workflow

Not a silly question, I wondered this myself for a long time before I got LSP to work…

Here is a screenshot:

Notice in particular:

  • in the modeline:

    • “LSP[julia-ls:4750]” in the minor-modes list indicates that the server process has started
    • “>bar(z::Float64)” comes from which-function-mode; I don’t think it has anything to do with lsp (and while writing this, I realize that the indication incorrectly refers to an argument named z)
    • “FlyC:0/1” is the indication that flycheckhas highlighted 0 errors and 1 warning in the buffer (you can see it in the left fringe in front of the “println(t)” line. This is fed by LSP
  • in the echo area:

    • “foo(x)” is displayed by eldoc-mode, which is fed by the documentation provided by LSP. One of the tweaks in my config above is that if the documentation for a particular function spans multiple lines, I don’t want the echo area to grow and show it, thereby messing with my window configuration.
  • in the “Foo.jl” buffer

    • indications in the left fringe and wiggly underlines are shown by flycheck to indicate errors/warnings. These come from LSP
    • indications in the right of the window show information about the symbols appearing in the line at point. This is lsp-ui-sideline-mode in action. If point was on a flycheck warning/error, then the error message would be displayed here instead.
  • a few actions that LSP allows you to perform:

    • M-xlsp-describe-thing-at-point: display the documentation for the thing at point (the “lsp-help” buffer shown here, was obtained by a prior invocation of this command, when point was on println)
    • M-.: find the definition of the symbol at point. In my configuration above, I remap this so that it uses lsp-ui-peek instead of the standard xref mechanism.
    • M-?: find all references to the symbol at point. Again, I remapped this to use lsp-ui-peek
    • M-xlsp-rename: rename all occurrences of the symbol at point.

This is more or less everything that I discovered (by reading/skimming the docs and experimenting a bit). There might be other stuff.

8 Likes