r/emacs•
DaTaha

Question about LSP usage

Question

I am using LSP from within Doom Emacs with evil enabled.

  1. Code actions: When there is only one available code action, lsp-execute-code-action automatically executes the action without asking me to confirm first, this is problematic since often I just want to see what code actions are available on a line, without necessarily executing them. What is the workaround for this?

  2. The intellisense messages on the right side of the screen are often truncated due to a lack of space on my screen. How can I view the entire message when this is the case? Surely there's a better way than just flycheck-list-errors since I have to actually visually search where in the list the error/warning corresponding to my current line is. Add further to this fact the ID columns on that interface is often truncated

https://preview.redd.it/vg876qu8055a1.png?width=943&format=png&auto=webp&s=38676201480eb5e8cad654d87ee999683e9bbc10

(And tangentially related: why does flycheck-list-errors provide a different error list than consult-lsp-diagnostics? I have an example of this which I can produce upon demand.)

​

  1. When LSP shows some information about what I'm typing in the minibuffer, how can I choose to view that information in full? See the image below. You can even see the "1/3" page label. How do I access those pages? If I press ESC so I can press K, pressing ESC gets rid of the message in the minibuffer and then attempting to press K will simply yield LSP :: No content at point.

​

https://preview.redd.it/q1e8so0c055a1.png?width=629&format=png&auto=webp&s=6a0b2cc1d971ae4bba8c30af8f29834e897d17b6

  1. next-error / flycheck-next-error does not let you navigate to warnings (despite warnings appearing in the flycheck 'error' list). Is there a command that also lets me navigate to the next/previous warning?

​

  1. Are there any other LSP usage tips I should know about?

Posted Dec 10, 2022, 9:24 PM UTC

52
yyoncho•
  1. lsp-auto-execute-action
  2. I usually hover the error and then check it in messages buffer. Not sure if this will work with your/default flycheck settings

(And tangentially related: why does flycheck-list-errors provide a different error list than consult-lsp-diagnostics? I have an example of this which I can produce upon demand.)

Consult method works on global list, flycheck works on buffer list. This is limitation of flycheck

  1. M-n/M-p

  2. Not sure about that one, it works fine on my side.

  3. Most likely yes.

1
DaTahaOP•

I have this in my config:

(after! lsp
    (setq lsp-auto-execute-action nil))

But this has no effect, and upon inspection the variable value always turns out to be set to t. (something keeps overriding the value for some reason)

1
yyoncho•

After lsp-mode not lsp

1
DaTahaOP•

Ah, my bad.

1
DaTahaOP•

About (2). Compare these two screenshots:`consult-lsp-diagnostics`: https://i.imgur.com/gPHqVhM.png`flycheck-list-errors`: https://i.imgur.com/ZXHgf6p.png

These screenshots are from the same buffer. And moreover, the consult method is producing the shorter list of the two.

About (3). Now I know how to navigate forwards and backwards between pages. But what do I do when the page I want to read is too big to be displayed inside the mininbuffer and is truncated. It is not displayed inside the *Messages* buffer.

1