helix icon indicating copy to clipboard operation
helix copied to clipboard

Intrusive Diagnostics

Open k2d222 opened this issue 3 years ago • 19 comments

Diagnostics appear on top of the code.

Diagnostics are always drawn from the top-right corner, with a max witdth of 100 chars and word wrapping.

I'm not sure what the best solution to this problem is, here are a few ideas:

  • just draw code over diagnostics (code has higher priority)
  • add a show / hide diagnostics command
  • ellipsize diagnostics and make a popup to show longer version
  • wrap diagnostics when conflicting with a line of code
  • Show diagnostics in a box after timeout, similar to the snippets / signature help box

(see this c++ code where STL template diagnostics are particularly verbose) Screenshot from 2022-01-08 17-04-06

k2d222 avatar Jan 08 '22 16:01 k2d222

Would https://github.com/helix-editor/helix/pull/1445 fix it for you?

kirawi avatar Jan 09 '22 03:01 kirawi

No it wouldn't, it's orthogonal :P

archseer avatar Jan 09 '22 03:01 archseer

There's two features that would be nice:

  • A config option that allows disabling the diagnostics overlay
  • Something like https://github.com/emacs-lsp/lsp-ui/blob/21ce926eedd41ef305c2d89412506ce59b1a7eac/lsp-ui-sideline.el#L216-L230 that considers where the last code character on the line is

archseer avatar Jan 09 '22 03:01 archseer

I have a similar need.

Purescript errors can be VERY long when there's a row type error. They get truncated and right aligned with the current diagnstics, making them almost useless.

Ideally I'd like to be able to:

  • display a diagnostic message on a scrollable popup
  • open the message on a new temporary buffer so that I can use it as a permanent reference while fixing the code

dariooddenino avatar Sep 09 '22 08:09 dariooddenino

+1 for the temporary buffer idea

ngraham20 avatar Oct 14 '22 22:10 ngraham20

Virtual Text #417 along with Soft Wrap #136 would also do it, as then, the virtual text could just be placed above or below the error line as virtually wrapped lines

ngraham20 avatar Oct 14 '22 22:10 ngraham20

can you do it like vscode does it with a problems pane

aspizu avatar Dec 29 '22 13:12 aspizu

Having the same issue where the diagnostic message covers the code that I'm trying to edit. Is there any workaround till this is fixed?

P.S. Stopped using VS Code a few months ago and tried a few flavours of NeoVim distros and then Helix. I have to say that I'm loving the Helix experience.

manan-gup avatar Jan 08 '23 01:01 manan-gup

In my opinion, the way neovim and lspsaga.nvim do it is quite nice:

  • There is some space and visual markers before showing one diagnostics message inline, a dot or square or similar, one per diagnostic in that line. The color of the markers and text indicates the diagnostic type(s). (Not too different from current behaviour, except for the separation and which line it is displayed in)
  • On jumping to a diagnostic, a small pop up opens, showing the diagnostics of this line in full-text separated from each other.

image image

In my opinion, the inline diagnostics are still quite clean, but also noticeable - more importantly, there is a clear separation between code and diagnostic, while not covering up any code. When the full diagnostic text is necessary, (i.e. when jumping through diagnostics), the full text is displayed in a pop up clearly separated from the text.

eliasboegel avatar Jan 25 '23 17:01 eliasboegel

+1 for simply drawing over the diagnostics, but only if a cursor is on the same line as the diagnostic.

dogunbound avatar Jan 27 '23 03:01 dogunbound

How about displaying error/warning messages in the status bar when the cursor is on top of the issue? It's keeps the errors out of the way but are there for when you need them. I had it setup like this previously while using ALE in Neovim and it worked well. Currently dealing with this sort of thing half way through typing:

Screenshot 2023-01-31 at 12 25 59

alexokten avatar Jan 31 '23 12:01 alexokten

is this feature already in the works? as i understand, virtual text is already supported through #5420

anyway, i'm just want to get rid off those awful lsp messages haha!

0rphee avatar Feb 22 '23 03:02 0rphee

https://github.com/helix-editor/helix/pull/6059

kirawi avatar Feb 22 '23 13:02 kirawi

Until #6059 lands, it seems to me the quick fix is to simply render the diagnostic messages at the bottom of the pane instead of the top. You can always shift up the view center (zz) to get cursor out of the way of something on the bottom, where the inverse is not true.

bugeats avatar Mar 17 '23 22:03 bugeats

Until #6059 / #6417 could there be a setting to allow hiding the diagnostics message that is in the top right corner? Maybe I missed it but I couldnt find it in the docs...

Teddy-94 avatar Aug 17 '23 21:08 Teddy-94

Also coming here to say that this makes editing in small windows (or many splits) really difficult. Half the time I can't see the code because the LSP errors hide what I'm editing.

In nvim the errors disappear while you're in insert mode (IME at least, I didn't used to think about it because they were never intrusive in neovim), which is one option, but another is just to change where they are displayed (I cannot find a setting for this in the docs).

This is the main thing marring the (otherwise great) helix experience for me.

gfarrell avatar Sep 11 '23 09:09 gfarrell

workaround: disable diagnostics feature

~/.config/helix/languages.toml

[[language]]
name = "c"
language-servers = [{name = "clangd", except-features=["diagnostics"]}]

see also: https://docs.helix-editor.com/languages.html?highlight=diagnostics#configuring-language-servers-for-a-language

0ihsan avatar Jan 05 '24 13:01 0ihsan

Until #6059 lands, it seems to me the quick fix is to simply render the diagnostic messages at the bottom of the pane instead of the top. You can always shift up the view center (zz) to get cursor out of the way of something on the bottom, where the inverse is not true.

How are you rendering the diagnostics at the bottom instead of the top? I can't find a reference to changing placement.

gnp-x avatar Mar 31 '24 16:03 gnp-x

https://github.com/helix-editor/helix/discussions/11096

kemelzaidan avatar Jul 05 '24 20:07 kemelzaidan