Skip to content

Commit 40e7110

Browse files
refactor: use vim.diagnostic.config to set signs
1 parent a8d2a99 commit 40e7110

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

lua/icons.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
local icons = {}
22

33
icons.diagnostics = {
4-
Error = "",
5-
Warn = "",
6-
Hint = "󰌵",
7-
Info = "",
4+
[vim.diagnostic.severity.ERROR] = "",
5+
[vim.diagnostic.severity.WARN] = "",
6+
[vim.diagnostic.severity.INFO] = "",
7+
[vim.diagnostic.severity.HINT] = "󰌵",
88
}
99

1010
icons.kinds = {

lua/plugins/lspconfig.lua

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ local default_opts = {
99
update_in_insert = false,
1010
virtual_text = true,
1111
severity_sort = true,
12-
signs = true,
12+
signs = { text = require("icons").diagnostics },
1313
},
1414

1515
inlay_hints = true,
1616
codelens = true,
1717
}
1818

1919
local function config(_, opts)
20-
local diagnostic_icons = require("icons").diagnostics
21-
2220
-- Server setup
2321
for server, server_opts in pairs(opts.servers) do
2422
vim.lsp.config(server, server_opts)
@@ -28,11 +26,6 @@ local function config(_, opts)
2826
-- Diagnostics
2927
vim.diagnostic.config(opts.diagnostics)
3028

31-
for name, icon in pairs(diagnostic_icons) do
32-
local hl = "DiagnosticSign" .. name
33-
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
34-
end
35-
3629
-- Inlay hints
3730
vim.lsp.inlay_hint.enable(opts.inlay_hints)
3831

0 commit comments

Comments
 (0)