lsp-ui icon indicating copy to clipboard operation
lsp-ui copied to clipboard

Is there a way to show diagnostics in popup?

Open Martinsos opened this issue 3 years ago • 5 comments

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

  • one problem is that text is right-aligned so it looses its natural structure, makes it harder to read.
  • long lines go into multiple lines

Martinsos avatar Oct 13 '22 12:10 Martinsos

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.

HaraldKi avatar Mar 09 '24 09:03 HaraldKi

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

jcs090218 avatar Mar 09 '24 10:03 jcs090218

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.

Martinsos avatar Mar 12 '24 10:03 Martinsos

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:

jcs090218 avatar Mar 13 '24 03:03 jcs090218

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

  • The first one has a post-command hook which seems to immediately remove the popup again.
  • The second one show the popup only if the flycheck-next-error jumps to a position which does not need scrolling. If scrolling is needed, no popup is shown.

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.

HaraldKi avatar Mar 15 '24 14:03 HaraldKi