diff --git a/lua/plugins/lsp/lsp-zero.lua b/lua/plugins/lsp/lsp-zero.lua deleted file mode 100644 index de65d0b..0000000 --- a/lua/plugins/lsp/lsp-zero.lua +++ /dev/null @@ -1,10 +0,0 @@ --- Install lsp-zero, to ease LSP support configuration --- https://lsp-zero.netlify.app --- https://github.com/VonHeikemen/lsp-zero.nvim/ - -return { - "VonHeikemen/lsp-zero.nvim", - branch = "v4.x", - lazy = true, - config = false, -} diff --git a/lua/plugins/lsp/lsp.lua b/lua/plugins/lsp/lsp.lua new file mode 100644 index 0000000..48a6c8b --- /dev/null +++ b/lua/plugins/lsp/lsp.lua @@ -0,0 +1,66 @@ +-- New LSP configuration (since neovim 0.11+) + +return { + 'mason-org/mason-lspconfig.nvim', + dependencies = { + 'mason-org/mason.nvim', + 'neovim/nvim-lspconfig', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + }, + config = function() + + require("mason").setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + } + } + }) + + require("mason-tool-installer").setup({ + ensure_installed = { + "prettier", + "ruff", + "stylua", + "tree-sitter-cli", + } + }) + + require("mason-lspconfig").setup({ + ensure_installed = { + "cssls", + "html", + "jsonls", + "lua_ls", + "marksman", + "ruff", + "yamlls", + }, + }) + + vim.lsp.config.marksman = { + filetypes = { "markdown", "quarto" }, + root_dir = vim.fs.root(0, { + ".git", + ".marksman.toml", + "._quarto.yml" + }) + } + + vim.lsp.config.jsonls = { + settings = { + json = { + schemas = require('schemastore').json.schemas(), + validate = { enable = true }, + } + } + } + + vim.lsp.config('*', { + capabilities = require('cmp_nvim_lsp').default_capabilities(), + }) + + end +} diff --git a/lua/plugins/lsp/lspconfig.lua b/lua/plugins/lsp/lspconfig.lua index b1a2d37..2c22d46 100644 --- a/lua/plugins/lsp/lspconfig.lua +++ b/lua/plugins/lsp/lspconfig.lua @@ -13,7 +13,7 @@ return { }, config = function() -- Import lsp-zero - local lsp_zero = require("lsp-zero") + -- local lsp_zero = require("lsp-zero") -- Activate some functionalities when a LSP is activated to the current -- file @@ -137,24 +137,24 @@ return { ) end - lsp_zero.extend_lspconfig({ - -- Display diagnostic signs in the sign column - sign_text = true, - -- Attach the keymap function - lsp_attach = lsp_attach, - -- Extend the default completion capabilities by LSP suggestions - capabilities = require("cmp_nvim_lsp").default_capabilities(), - }) - - -- Use lsp_zero to configure interface - lsp_zero.ui({ - float_border = "rounded", - sign_text = { - error = " ", - warn = " ", - hint = "󰠠 ", - info = " ", - }, - }) + -- lsp_zero.extend_lspconfig({ + -- -- Display diagnostic signs in the sign column + -- sign_text = true, + -- -- Attach the keymap function + -- lsp_attach = lsp_attach, + -- -- Extend the default completion capabilities by LSP suggestions + -- capabilities = require("cmp_nvim_lsp").default_capabilities(), + -- }) + -- + -- -- Use lsp_zero to configure interface + -- lsp_zero.ui({ + -- float_border = "rounded", + -- sign_text = { + -- error = " ", + -- warn = " ", + -- hint = "󰠠 ", + -- info = " ", + -- }, + -- }) end, } diff --git a/lua/plugins/lsp/mason.lua b/lua/plugins/lsp/mason.lua.save similarity index 91% rename from lua/plugins/lsp/mason.lua rename to lua/plugins/lsp/mason.lua.save index 09536d9..146fcc7 100644 --- a/lua/plugins/lsp/mason.lua +++ b/lua/plugins/lsp/mason.lua.save @@ -44,10 +44,7 @@ return { }) mason_lspconfig.setup({ - -- LSP to be installed by default - -- Available LSP: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md - -- LSP can be installed with :Mason - -- But installing LSP through the following list is better + -- https://github.com/mason-org/mason-lspconfig.nvim?tab=readme-ov-file#default-configuration ensure_installed = { "cssls", "html", @@ -62,7 +59,7 @@ return { function(server_name) -- Activate all LSP from the ensure_installed list with its default -- configuration - lspconfig[server_name].setup({}) + vim.lsp.enable(server_name) end, -- Then, configure each LSP as needed diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index 75fd02d..5be3bd1 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -110,6 +110,7 @@ return { }, }, { name = "path" }, + { name = "ruff" }, { name = "emoji" }, }), @@ -128,10 +129,13 @@ return { nvim_lua = "[Lua]", lazydev = "[Lazydev]", path = "[Path]", + ruff = "[Ruff]", emoji = "[Emoji]", }, }), }, + + }) end,