Skip to content

Add option to use diagnostic signs #1826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hermitmaster opened this issue Dec 13, 2022 · 7 comments
Open

Add option to use diagnostic signs #1826

hermitmaster opened this issue Dec 13, 2022 · 7 comments
Labels
feature request QOL Quality Of Life Improvement

Comments

@hermitmaster
Copy link

Can this functionality be implemented utilising API?
nvim-tree exposes extensive API (see :h nvim-tree-api). Can it be used to achieve your goal? Is there a missing API that would make it possible?
Given stable status of nvim-tree it's preferred to add new API than new functionality.

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like

  use({
    'nvim-tree/nvim-tree.lua',
    requires = 'nvim-tree/nvim-web-devicons',
    config = function()
      require('nvim-tree').setup({
        diagnostics = {
          enable = true,
          -- This is the additional option I'm proposing
          use_diagnostic_signs = true,
          on_dirs = true,
        },
      })
    end,
  })

Describe alternatives you've considered

  use({
    'nvim-tree/nvim-tree.lua',
    requires = 'nvim-tree/nvim-web-devicons',
    config = function()
      require('nvim-tree').setup({
        diagnostics = {
          enable = true,
          icons = {
            error = vim.fn.sign_getdefined('DiagnosticSignError')[1].text,
            hint = vim.fn.sign_getdefined('DiagnosticSignHint')[1].text,
            info = vim.fn.sign_getdefined('DiagnosticSignInfo')[1].text,
            warning = vim.fn.sign_getdefined('DiagnosticSignWarn')[1].text,
          },
        },
      })
    end,
  })

Additional context
I think this is probably the common scenario. Most folks want to share the diagnostic signs across plugins related to LSP. I'd be happy to open a PR for this if it is determined to be valuable.

@alex-courtis
Copy link
Member

To confirm your proposal: this is a change to the diagnostics icons/glyphs, not diagnostics itself.

This is a good idea. We should use the string|table pattern, something like:

    *nvim-tree.diagnostics.icons*
    Icons for diagnostic severity.
    Set to `"DiagnosticSign"` to use signs defined as per |diagnostic-signs|,
    falling back to defaults when sign is not defined.
      Type: `table` | `string`, Default: `{ hint = "", info = "", warning = "", error = "" }`

Fallback shouldn't be a drama.

@alex-courtis alex-courtis added the QOL Quality Of Life Improvement label Dec 16, 2022
@hermitmaster
Copy link
Author

That is what I was proposing. 👍

@alex-courtis
Copy link
Member

FIELD_OVERRIDE_TYPECHECK has reached a point where disambiguation is a problem.

Please update the keys to contain full paths in the user's options.

I would be most grateful if you could apply the same to FIELD_SKIP_VALIDATE.

@alex-courtis
Copy link
Member

See nvim-lualine/lualine.nvim#1091

@gegoune
Copy link
Collaborator

gegoune commented Nov 28, 2023

I would even argue so that should become default value. Users set up diagnostics and expect them to propagate throughout editor. I certainly set nvim-tree's diagnostic to the same characters.

@alex-courtis
Copy link
Member

I would even argue so that should become default value. Users set up diagnostics and expect them to propagate throughout editor. I certainly set nvim-tree's diagnostic to the same characters.

Defaults, yes please.

I've already applied the standard groups for diagnostic highlighting: https://github.com/nvim-tree/nvim-tree.lua/pull/2455/files#diff-16d5e714e01617fa3906fbcf68963baeb235dde81bc9fd2e7a5ba95526765e18R112

@alex-courtis
Copy link
Member

alex-courtis commented Dec 3, 2023

DiagnosticSign* aren't nvim standard or built in signs.

Highlight groups are defined in plugins like https://github.com/echasnovski/mini.base16/tree/main and used by lualine etc. if they are present.

The lualine PR above hasn't been merged; it's still using the same mechanism as nvim-tree.

This is possible following #2415 - we can simply use any pre-defined signs:

function Decorator:define_sign(icon)

@alex-courtis alex-courtis mentioned this issue Dec 31, 2023
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request QOL Quality Of Life Improvement
Projects
None yet
Development

No branches or pull requests

3 participants