diff --git a/lua/config/icons.lua b/lua/config/icons.lua new file mode 100644 index 00000000..e8de0cd2 --- /dev/null +++ b/lua/config/icons.lua @@ -0,0 +1,30 @@ +return { + diagnostics = { + Error = " ", + Warn = " ", + Hint = " ", + Info = " ", + }, + kinds = { + Class = " ", + Color = " ", + Constant = " ", + Constructor = " ", + Enum = "了 ", + EnumMember = " ", + Field = " ", + File = " ", + Folder = " ", + Function = " ", + Interface = "ﰮ ", + Keyword = " ", + Method = "ƒ ", + Property = " ", + Snippet = "﬌ ", + Struct = " ", + Text = " ", + Unit = " ", + Value = " ", + Variable = " ", + }, +} diff --git a/lua/plugins/lsp/init.lua b/lua/plugins/lsp/init.lua index c8a05ac5..387f0901 100644 --- a/lua/plugins/lsp/init.lua +++ b/lua/plugins/lsp/init.lua @@ -13,11 +13,24 @@ return { dependencies = { { "folke/neoconf.nvim", cmd = "Neoconf", config = true }, { "folke/neodev.nvim", config = true }, - { "williamboman/mason.nvim", config = true }, - { "williamboman/mason-lspconfig.nvim", config = { ensure_installed = vim.tbl_keys(servers) } }, + { "williamboman/mason.nvim", config = true, cmd = "Mason" }, + { "williamboman/mason-lspconfig.nvim", config = { automatic_installation = true } }, "hrsh7th/cmp-nvim-lsp", }, config = function() + -- diagnostics + for name, icon in pairs(require("config.icons").diagnostics) do + name = "DiagnosticSign" .. name + vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) + end + vim.diagnostic.config({ + underline = true, + update_in_insert = false, + virtual_text = { spacing = 4, prefix = "●" }, + severity_sort = true, + }) + + -- lspconfig local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) for server, opts in pairs(servers) do opts.capabilities = capabilities