chore: complete the diagnostic setup migration

Colors groups and icons are now in diagnostics.lua. They are defined on
setup which allows an easier configuration and better documentation.
`lsp_diagnostics` boolean value has been moved into a table `diagnostics`
with `enable` and `icons` as properties.
This commit is contained in:
kiyan
2021-10-10 11:41:57 +02:00
parent 64c31aaec7
commit 94b8604e86
6 changed files with 73 additions and 34 deletions

View File

@@ -7,6 +7,7 @@ local colors = require'nvim-tree.colors'
local renderer = require'nvim-tree.renderer'
local fs = require'nvim-tree.fs'
local view = require'nvim-tree.view'
local utils = require'nvim-tree.utils'
local _config = {
is_windows = vim.fn.has('win32') == 1 or vim.fn.has('win32unix') == 1,
@@ -416,7 +417,6 @@ local DEFAULT_OPTS = {
auto_close = false,
hijack_cursor = false,
update_cwd = false,
lsp_diagnostics = false,
update_focused_file = {
enable = false,
update_cwd = false,
@@ -427,6 +427,15 @@ local DEFAULT_OPTS = {
cmd = nil,
args = {}
},
diagnostics = {
enable = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
}
function M.setup(conf)
@@ -439,7 +448,7 @@ function M.setup(conf)
_config.open_on_setup = opts.open_on_setup
_config.ignore_ft_on_setup = opts.ignore_ft_on_setup
if type(opts.update_to_buf_dir) == "boolean" then
require'nvim-tree.utils'.echo_warning("update_to_buf_dir is now a table, see :help nvim-tree.update_to_buf_dir")
utils.echo_warning("update_to_buf_dir is now a table, see :help nvim-tree.update_to_buf_dir")
_config.update_to_buf_dir = {
enable = opts.update_to_buf_dir,
auto_open = opts.update_to_buf_dir,
@@ -448,6 +457,10 @@ function M.setup(conf)
_config.update_to_buf_dir = opts.update_to_buf_dir
end
if opts.lsp_diagnostics ~= nil then
utils.echo_warning("setup.lsp_diagnostics has been removed, see :help nvim-tree.diagnostics")
end
require'nvim-tree.colors'.setup()
require'nvim-tree.view'.setup(opts.view or {})
require'nvim-tree.diagnostics'.setup(opts)