feat(sings): use new diagnostic configuration + improve UI

This commit is contained in:
doryan 2025-04-17 18:40:46 +04:00
parent 3f05e62ac8
commit 9609e2d7eb
4 changed files with 99 additions and 54 deletions

View File

@ -8,6 +8,18 @@ local vanila_vim_autostart_commands = {
"set clipboard=unnamedplus" "set clipboard=unnamedplus"
} }
vim.diagnostic.config({
virtual_text = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = '󰅗 ',
[vim.diagnostic.severity.WARN] = '󰀧 ',
[vim.diagnostic.severity.INFO] = '󰬐',
[vim.diagnostic.severity.HINT] = '󰌵',
},
}
})
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.opt.fillchars = { eob = " " } vim.opt.fillchars = { eob = " " }
@ -18,6 +30,7 @@ end
if vim.lsp.inlay_hint then if vim.lsp.inlay_hint then
vim.lsp.inlay_hint.enable(true, { 0 }) vim.lsp.inlay_hint.enable(true, { 0 })
end end
require("config.lazy") require("config.lazy")
require("config.plugins.autotag") require("config.plugins.autotag")
require("config.plugins.autocomplete") require("config.plugins.autocomplete")
@ -29,7 +42,6 @@ require("config.plugins.gitsigns")
require("config.plugins.ibl") require("config.plugins.ibl")
require("config.plugins.hover_actions") require("config.plugins.hover_actions")
require("config.plugins.lsp_config") require("config.plugins.lsp_config")
require("config.plugins.lsp_diagnostic")
require("config.plugins.lualine") require("config.plugins.lualine")
require("config.plugins.noice") require("config.plugins.noice")
require("toggleterm").setup() require("toggleterm").setup()

View File

@ -1,5 +1,11 @@
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = true
}
)
lspconfig.clangd.setup({}) lspconfig.clangd.setup({})
lspconfig.lua_ls.setup({ lspconfig.lua_ls.setup({

View File

@ -1,7 +1,5 @@
local _colors = { "DiffAdd", "DiffChange", "RedrawDebugRecompose" } local _colors = { "DiffAdd", "DiffChange", "RedrawDebugRecompose" }
require("lualine").setup({ require("lualine").setup({
options = { options = {
icons_enabled = true, icons_enabled = true,
@ -42,7 +40,31 @@ require("lualine").setup({
source = nil, -- A function that works as a data source for diff. source = nil, -- A function that works as a data source for diff.
} }
}, },
lualine_x = { 'encoding', 'filetype', 'diagnostics', 'lsp' }, lualine_x = { 'encoding', 'filetype',
{
'diagnostics',
sources = { 'nvim_diagnostic', 'coc' },
sections = { 'error', 'warn', 'info', 'hint' },
diagnostics_color = {
error = 'DiagnosticError', -- Changes diagnostics' error color.
warn = 'DiagnosticWarn', -- Changes diagnostics' warn color.
info = 'DiagnosticInfo', -- Changes diagnostics' info color.
hint = 'DiagnosticHint', -- Changes diagnostics' hint color.
},
symbols = {
hint = '󰌵 ',
info = '󰬐 ',
warn = '󰀧 ',
error = '󰅗 ',
},
colored = true, -- Displays diagnostics status in color if set to true.
update_in_insert = false, -- Update diagnostics in insert mode.
always_visible = false, -- Show diagnostics even if there are none.
}
},
lualine_y = { 'progress' }, lualine_y = { 'progress' },
lualine_z = { 'location' } lualine_z = { 'location' }
}, },

View File

@ -1,52 +1,57 @@
vim.fn.sign_define("LspDiagnosticsSignError",
{text = "󰅙 ", texthl = "LspDiagnosticsSignError"})
vim.fn.sign_define("LspDiagnosticsSignWarning",
{text = "󱇎 ", texthl = "LspDiagnosticsSignWarning"})
vim.fn.sign_define("LspDiagnosticsSignInformation",
{text = "󰰄 ", texthl = "LspDiagnosticsSignInformation"})
vim.fn.sign_define("LspDiagnosticsSignHint",
{text = "󰐗 ", texthl = "LspDiagnosticsSignHint"})
require("neo-tree").setup({ require("neo-tree").setup({
close_if_last_window = false, close_if_last_window = false,
popup_border_style = "rounded", popup_border_style = "rounded",
enable_git_status = true, enable_git_status = true,
enable_diagnostics = true, enable_diagnostics = true,
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, open_files_do_not_replace_types = { "terminal", "trouble", "qf" },
sort_case_insensitive = false, sort_case_insensitive = false,
sort_function = nil , sort_function = nil,
default_component_configs = { default_component_configs = {
indent = { diagnostics = {
with_expanders = true, symbols = {
}, hint = '󰌵',
icon = { info = '󰬐',
folder_closed = "󰉋", warn = '󰀧',
folder_open = "󰝰", error = '󰅗',
folder_empty = "󰉖", },
default = "*", highlights = {
highlight = "NeoTreeFileIcon" hint = "DiagnosticSignHint",
}, info = "DiagnosticSignInfo",
modified = { warn = "DiagnosticSignWarn",
symbol = "󰧞", error = "DiagnosticSignError",
highlight = "NeoTreeModified", },
}, },
name = { indent = {
trailing_slash = false, with_expanders = true,
use_git_status_colors = true, },
highlight = "NeoTreeFileName", icon = {
}, folder_closed = "󰉋",
git_status = { folder_open = "󰝰",
symbols = { folder_empty = "󰉖",
added = "󰜄", default = "*",
modified = "󰑕", highlight = "NeoTreeFileIcon"
deleted = "󰅗", },
renamed = "󰛂", modified = {
untracked = "󰞋", symbol = "󰧞",
ignored = "󰿠", highlight = "NeoTreeModified",
unstaged = "󰄱", },
staged = "󰄵", name = {
conflict = "", trailing_slash = false,
} use_git_status_colors = true,
}, highlight = "NeoTreeFileName",
}, },
git_status = {
symbols = {
added = "󰜄",
modified = "󰑕",
deleted = "󰅗",
renamed = "󰛂",
untracked = "󰞋",
ignored = "󰿠",
unstaged = "󰄱",
staged = "󰄵",
conflict = "",
}
},
},
}) })