emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

Is there a way to show diagnostics in popup? #735

Open Martinsos opened 1 year ago

Martinsos commented 1 year ago

Right now my diagnostics are getting shown in the sideline, but that can become quite a mess when window doesn't have big width, and sideline contains a lot of info (code actions, errors, ...).

I can get turn off the sideline and then it shows in the minibuffer, but it doesn't behave much nicer -> I lose colors, formatting is also not great.

Is there a way to show diagnostics in the popup that would show up either at the fixed position, or at the cursor? Right now we already have popups for docs, could we also use them to show diagnostics?

Or if now, is there a way to make diagnostics in sideline to behave nicer? To explain what do I mean by messy right now, here is a screenshot:

image

HaraldKi commented 3 months ago

Indeed for diagnostics, in particular compiler error messages, the sideline is not that helpful. I don't have the editor window full screen, so even with a Lsp Ui Sideline Diagnostic Max Line Length of 150 many compiler error message fall off the screen to the right.

jcs090218 commented 3 months ago

You can turn off the diagnostic by setting lsp-ui-sideline-show-diagnostics to nil.

Martinsos commented 3 months ago

You can turn off the diagnostic by setting lsp-ui-sideline-show-diagnostics to nil.

What do I get with that though -> they start showing in minibuffer, right?

What I was hoping for instead was to have them in the popup, or on the sideline but better formatted.

jcs090218 commented 3 months ago

What do I get with that though -> they start showing in minibuffer, right?

No, it depends on the value of the variable flycheck-display-errors-function. The default value is #'flycheck-display-error-messages, so you will see it in the minibuffer.

What I was hoping for instead was to have them in the popup, or on the sideline but better formatted.

Here are some alternatives:

HaraldKi commented 3 months ago

I tried flycheck-popup-tip as well as flycheck-posframe and both have problems with flycheck-next/previous-error.

Both work when using cursor movement to walk the cursor onto a point where flycheck has marked an error.

I am not asking anyone to investigate this, as reasons may still be found in my peculiar setup, but the above may safe someone some head scratching when seeing the same problems.