Add option to use diagnostic signs
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.
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.
That is what I was proposing. 👍
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.
See https://github.com/nvim-lualine/lualine.nvim/pull/1091
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.
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
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: https://github.com/nvim-tree/nvim-tree.lua/blob/8857c79cfd94613eae564d7c5611052e40999b4c/lua/nvim-tree/renderer/decorator/init.lua#L96