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"
}
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.fillchars = { eob = " " }
@ -18,6 +30,7 @@ end
if vim.lsp.inlay_hint then
vim.lsp.inlay_hint.enable(true, { 0 })
end
require("config.lazy")
require("config.plugins.autotag")
require("config.plugins.autocomplete")
@ -29,7 +42,6 @@ require("config.plugins.gitsigns")
require("config.plugins.ibl")
require("config.plugins.hover_actions")
require("config.plugins.lsp_config")
require("config.plugins.lsp_diagnostic")
require("config.plugins.lualine")
require("config.plugins.noice")
require("toggleterm").setup()

View File

@ -1,5 +1,11 @@
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.lua_ls.setup({

View File

@ -1,7 +1,5 @@
local _colors = { "DiffAdd", "DiffChange", "RedrawDebugRecompose" }
require("lualine").setup({
options = {
icons_enabled = true,
@ -42,7 +40,31 @@ require("lualine").setup({
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_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({
close_if_last_window = false,
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
open_files_do_not_replace_types = { "terminal", "trouble", "qf" },
sort_case_insensitive = false,
sort_function = nil ,
default_component_configs = {
indent = {
with_expanders = true,
},
icon = {
folder_closed = "󰉋",
folder_open = "󰝰",
folder_empty = "󰉖",
default = "*",
highlight = "NeoTreeFileIcon"
},
modified = {
symbol = "󰧞",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
added = "󰜄",
modified = "󰑕",
deleted = "󰅗",
renamed = "󰛂",
untracked = "󰞋",
ignored = "󰿠",
unstaged = "󰄱",
staged = "󰄵",
conflict = "",
}
},
},
close_if_last_window = false,
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
open_files_do_not_replace_types = { "terminal", "trouble", "qf" },
sort_case_insensitive = false,
sort_function = nil,
default_component_configs = {
diagnostics = {
symbols = {
hint = '󰌵',
info = '󰬐',
warn = '󰀧',
error = '󰅗',
},
highlights = {
hint = "DiagnosticSignHint",
info = "DiagnosticSignInfo",
warn = "DiagnosticSignWarn",
error = "DiagnosticSignError",
},
},
indent = {
with_expanders = true,
},
icon = {
folder_closed = "󰉋",
folder_open = "󰝰",
folder_empty = "󰉖",
default = "*",
highlight = "NeoTreeFileIcon"
},
modified = {
symbol = "󰧞",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
added = "󰜄",
modified = "󰑕",
deleted = "󰅗",
renamed = "󰛂",
untracked = "󰞋",
ignored = "󰿠",
unstaged = "󰄱",
staged = "󰄵",
conflict = "",
}
},
},
})