How to copy diagnostic messages in doom emacs?

Lsp errors that shows when cursor on line that has the error?

I would like to have a keybind for this

5 points · 1 comments · view on lemmy.world

1 Comments

donio@lemmy.world · 2 pts · 120d

edit: I missed that it's LSP messages. Assuming eglot you can get them in a buffer using M-x flymake-show-buffer-diagnostics

original:

I don't use Doom specifically in general you'd do this by switching to the *Messages* buffer and copy the relevant lines from there as usual.

If you really wanted a command for it you could do something like this:

(defun my-copy-last-messages (n)
  (interactive "p")
  (with-current-buffer "*Messages*"
    (copy-region-as-kill
     (line-beginning-position
      (- 1 n))
     (point-max))))

This assumes that the cursors is at the end of the Messages buffer as usual. Not sure if that line positioning is correct, only tested it briefly.