Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Add the option to show diagnostics in the echo area #10

Open

Description

@subsonik

Hi,

Great work with this plugin, your plugins have quickyl become an essential part of my setup! :)

Would it be possible to add the ability to show diagnostics in the echo area, ala https://github.com/Shougo/echodoc.vim ?

I find popups annoying because they obstruct my code and get in the way, and virtual text is also quite jarring and looks silly when chatty languages like Rust attempt to show errors that are 50-70 characters long and they end up going off screen. Especially when I have splits open, the error messages can be quite useless because they show nothing of use before getting cut off.

The echo area seems like the ideal place to show diagnostics to me, and I'm surprised more plugins don't use it.

Thanks.

Activity

  1. haorenW1025 commented on Apr 28, 2020

    @haorenW1025
    Collaborator

    Hmm I'll try to see if it's possible, but having will having 50-70 lines in echo area help? Just curious though. Also I'm working on some custom preview in completion-nvim inspired by ncm, will this be a better place to show diagnostics? Let me know what you think:)

  2. subsonik commented on Apr 28, 2020

    @subsonik
    Author

    Do you mean the let g:float_preview#docked = 1 preview shown in your link? I personally think that's a little distracting, but of course it's highly subjective. :)

    Maybe if implementing diagnostic messages in the echo area is too much work, would it instead be possible to show a popup window when hovering the cursors over the offending text, instead of having to use the NextDiagnostic and PrevDiagnostic commands?

    I can open a new issue and close this one if you like?

  3. haorenW1025 commented on Apr 29, 2020

    @haorenW1025
    Collaborator

    Actually implement it in echo area is definitely possible, but that could lead to various issues. For one example, if the echo area exceed one line it would requires you to press enter to continue editing, which will also be distracting.
    My suggestion is disable the auto popup by

    let g:diagnostic_auto_popup_while_jump = 1

    and trigger the line diagnostic with a mapping instead.

    nnoremap <leader>d <cmd>lua vim.lsp.util.show_line_diagnostics()<CR>
  4. subsonik commented on Apr 29, 2020

    @subsonik
    Author

    My suggestion is disable the auto popup by

    let g:diagnostic_auto_popup_while_jump = 1

    and trigger the line diagnostic with a mapping instead.

    nnoremap <leader>d <cmd>lua vim.lsp.util.show_line_diagnostics()<CR>

    Thanks for the suggestion, but running lua vim.lsp.util.show_line_diagnostics() while diagnostic-nvim is enabled doesn't seem to have any effect. If I disable diagnostic-nvim, then I get a popup as expected. Here is my current config:

    let g:diagnostic_auto_popup_while_jump = 1
    " let g:diagnostic_enable_virtual_text = 0
    " let g:diagnostic_insert_delay = 0
    " let g:diagnostic_level = 'Information'
    " let g:space_before_virtual_text = 2
  5. haorenW1025 commented on Apr 29, 2020

    @haorenW1025
    Collaborator

    Oh my fault, first of all you should use let g:diagnostic_auto_popup_while_jump = 0 to disable auto popup instead. Secondly since I overwrite the callback function and store the information locally, you should use

    nnoremap <leader>d <cmd>lua require'diagnostic.util'.show_line_diagnostics()<CR>

    I should put this in README though.

  6. swarn commented on Oct 8, 2020

    @swarn

    For those like me who found this issue by searching, I believe that last comment is out of date. However, the mapping mentioned earlier works:

    nnoremap <leader>d <cmd>lua vim.lsp.util.show_line_diagnostics()<CR>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions