summaryrefslogtreecommitdiff
path: root/lua/ache/plugins/lsp
diff options
context:
space:
mode:
authorache <ache@ache.one>2025-05-17 17:36:54 +0200
committerache <ache@ache.one>2025-05-17 17:36:54 +0200
commit7066715c44c653f3c16e28e740361ad9b427cab4 (patch)
tree99463ff5b9f7ecae0ded4b1f35242cf0a0a09e70 /lua/ache/plugins/lsp
parentAdd an option to quickly disable any plugin (diff)
Update configuration to add LSP nvim 0.11 support
Diffstat (limited to 'lua/ache/plugins/lsp')
-rw-r--r--lua/ache/plugins/lsp/lspconfig.lua64
-rw-r--r--lua/ache/plugins/lsp/ltex-extra.lua2
-rw-r--r--lua/ache/plugins/lsp/mason-lspconf.lua225
-rw-r--r--lua/ache/plugins/lsp/mason.lua (renamed from lua/ache/plugins/lsp/mason-config.lua)5
-rw-r--r--lua/ache/plugins/lsp/rust-tools.lua2
5 files changed, 44 insertions, 254 deletions
diff --git a/lua/ache/plugins/lsp/lspconfig.lua b/lua/ache/plugins/lsp/lspconfig.lua
index 65cf1dd..b11409f 100644
--- a/lua/ache/plugins/lsp/lspconfig.lua
+++ b/lua/ache/plugins/lsp/lspconfig.lua
@@ -7,16 +7,11 @@ return {
enabled = true,
event = { "BufReadPre", "BufNewFile" },
dependencies = {
- "hrsh7th/cmp-nvim-lsp",
- "williamboman/mason-lspconfig.nvim",
- { "antosha417/nvim-lsp-file-operations", config = true },
- { "folke/neodev.nvim", opts = {} },
+ -- "hrsh7th/cmp-nvim-lsp",
+ -- { "antosha417/nvim-lsp-file-operations", config = true },
+ -- { "folke/neodev.nvim", opts = {} },
},
config = function()
- local lspconfig = require("lspconfig")
- local mason_lspconfig = require("mason-lspconfig")
- local cmp_nvim_lsp = require("cmp_nvim_lsp")
-
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
@@ -117,41 +112,36 @@ return {
end,
})
- -- Used to enable auto-completion (assign to every lsp server config)
- local capabilities = cmp_nvim_lsp.default_capabilities()
-
-- Change the diagnostics symbols in the sign column (gutter)
+ -- BUG: Deprecated,
+ --[[
local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
-
- --[[
- mason_lspconfig.setup_handlers({
- -- default handler for installed servers
- function(server_name)
- lspconfig[server_name].setup({
- capabilities = capabilities,
- })
- end,
- ["svelte"] = function()
- -- Configuration specific to svelte LSP server
-
- end,
- ["ltex"] = function()
-
- end,
- ["lua_ls"] = function()
-
- end,
- ["harper_ls"] = function()
-
- end,
- ["pyright"] = function()
-
- end,
- })
--]]
+ vim.diagnostic.config({
+ signs = {
+ text = {
+ [vim.diagnostic.severity.ERROR] = " ",
+ [vim.diagnostic.severity.WARN] = " ",
+ [vim.diagnostic.severity.INFO] = "󰋼 ",
+ [vim.diagnostic.severity.HINT] = "󰌵 ",
+ },
+ texthl = {
+ [vim.diagnostic.severity.ERROR] = "Error",
+ [vim.diagnostic.severity.WARN] = "Error",
+ [vim.diagnostic.severity.HINT] = "Hint",
+ [vim.diagnostic.severity.INFO] = "Info",
+ },
+ numhl = {
+ [vim.diagnostic.severity.ERROR] = "",
+ [vim.diagnostic.severity.WARN] = "",
+ [vim.diagnostic.severity.HINT] = "",
+ [vim.diagnostic.severity.INFO] = "",
+ },
+ },
+ })
end,
}
diff --git a/lua/ache/plugins/lsp/ltex-extra.lua b/lua/ache/plugins/lsp/ltex-extra.lua
index d07bf7a..1bc390e 100644
--- a/lua/ache/plugins/lsp/ltex-extra.lua
+++ b/lua/ache/plugins/lsp/ltex-extra.lua
@@ -11,7 +11,7 @@ local ltex_ls_opts = {
return {
"barreiroleo/ltex_extra.nvim",
- enabled = true,
+ enabled = false,
ft = { "markdown", "tex", "text" },
dependencies = { "neovim/nvim-lspconfig" },
-- Yes, you can use the opts field, just I'm showing the setup explicitly.
diff --git a/lua/ache/plugins/lsp/mason-lspconf.lua b/lua/ache/plugins/lsp/mason-lspconf.lua
index 3f8b67a..df242e6 100644
--- a/lua/ache/plugins/lsp/mason-lspconf.lua
+++ b/lua/ache/plugins/lsp/mason-lspconf.lua
@@ -4,234 +4,29 @@
return {
-- NOTE: mason is a dependencie of mason-lspconfig. Not the other way around.
- "williamboman/mason-lspconfig.nvim",
+ "mason-org/mason-lspconfig.nvim",
enabled = true,
dependencies = {
- "williamboman/mason.nvim",
- "WhoIsSethDaniel/mason-tool-installer.nvim",
- "mfussenegger/nvim-dap",
- "jay-babu/mason-nvim-dap.nvim",
+ "mason-org/mason.nvim",
+ -- "WhoIsSethDaniel/mason-tool-installer.nvim",
+ -- "mfussenegger/nvim-dap",
+ -- "jay-babu/mason-nvim-dap.nvim",
"neovim/nvim-lspconfig",
},
config = function()
local mason_lspconfig = require("mason-lspconfig")
- local mason_tool_installer = require("mason-tool-installer")
- local mason_dap = require("mason-nvim-dap")
+ -- local mason_tool_installer = require("mason-tool-installer")
+ -- local mason_dap = require("mason-nvim-dap")
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
- mason_dap.setup({
- automatic_installation = true,
- ensure_installed = {
- "codelldb",
- },
- --[[
- handlers = {
- -- cette première fonction est le "gestionnaire par défaut"
- -- elle s'applique à chaque serveur linguistique sans "gestionnaire personnalisé"
- function(server_name)
- require("lspconfig")[server_name].setup({})
- end,
- },
- --]]
- })
-
mason_lspconfig.setup({
- lazy = false,
- automatic_installation = true,
- automatic_enable = {
- exclude = { "harper_ls" },
- },
ensure_installed = {
- "html",
- "cssls",
- -- "harper_ls",
- "ltex",
- "svelte",
"lua_ls",
- "pyright",
- "ruff",
"rust_analyzer",
- },
- handlers = {
- -- default handler for installed servers
- function(server_name)
- lspconfig[server_name].setup({
- capabilities = capabilities,
- })
- end,
- ["svelte"] = function()
- -- Configuration specific to svelte LSP server
- lspconfig["svelte"].setup({
- capabilities = capabilities,
- on_attach = function(client, _)
- vim.api.nvim_create_autocmd("BufWritePost", {
- pattern = { "*.js", "*.mjs", "*.svelte" },
- callback = function(ctx)
- -- Here use ctx.match instead of ctx.file
- client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
- end,
- })
- end,
- })
- end,
- ["ltex"] = function()
- lspconfig["ltex"].setup({
- filetypes = { "latex", "typst", "typ", "bib", "markdown", "plaintex", "tex" },
- settings = {
- ltex = {
- enabled = { "latex", "typst", "typ", "bib", "markdown", "plaintex", "tex" },
- language = { "en-GB", "fr-FR" },
- setenceCacheSize = 2000,
- additionalRules = {
- enablePickyRules = true,
- motherTongue = "fr-FR",
- },
- checkFrequency = "edit",
- },
- },
- })
- end,
- ["lua_ls"] = function()
- lspconfig["lua_ls"].setup({
- capabilities = capabilities,
- settings = {
- Lua = {
- -- Make the language server recognize the "vim" global variable
- diagnostics = {
- globals = { "vim" },
- },
- completion = {
- callSnippet = "Replace",
- },
- },
- },
- })
- end,
- ["harper_ls"] = function()
- lspconfig["harper_ls"].setup({
- settings = {
- ["harper-ls"] = {
- markdown = {
- IgnoreLinkTitle = true,
- },
- linters = {
- SpellCheck = true,
- SpelledNumbers = true,
- AnA = true,
- SentenceCapitalization = true,
- UnclosedQuotes = true,
- WrongQuotes = false,
- LongSentences = true,
- RepeatedWords = true,
- Spaces = true,
- Matcher = true,
- CorrectNumberSuffix = true,
- },
- isolateEnglish = true,
- },
- },
- })
- end,
- ["pyright"] = function()
- lspconfig["pyright"].setup({
- capabilities = capabilities,
- settings = {
- python = {
- pythonPath = "/usr/bin/python",
- },
- },
- })
- end,
- },
- })
-
- mason_tool_installer.setup({
- ensure_installed = {
- "prettier", -- Web related formatter
- "stylua", -- Lua formater
- -- "isort", -- Python formater
- -- "black", -- Python formater too
- "ruff", -- Python linter
- "eslint_d", -- JavaScript linter
- "llm-ls",
- "shfmt",
- },
- })
-
- lspconfig["svelte"].setup({
- -- capabilities = capabilities,
- on_attach = function(client, _)
- vim.api.nvim_create_autocmd("BufWritePost", {
- pattern = { "*.js", "*.mjs", "*.svelte" },
- callback = function(ctx)
- -- Here use ctx.match instead of ctx.file
- client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
- end,
- })
- end,
- })
-
- lspconfig["lua_ls"].setup({
- -- capabilities = capabilities,
- settings = {
- Lua = {
- -- Make the language server recognize the "vim" global variable
- diagnostics = {
- globals = { "vim" },
- },
- completion = {
- callSnippet = "Replace",
- },
- },
- },
- })
- lspconfig["harper_ls"].setup({
- filetypes = { "latex", "typst", "typ", "bib", "markdown", "plaintex", "tex" },
- settings = {
- ["harper-ls"] = {
- markdown = {
- IgnoreLinkTitle = true,
- },
- linters = {
- SpellCheck = true,
- SpelledNumbers = false,
- AnA = true,
- SentenceCapitalization = true,
- UnclosedQuotes = false,
- WrongQuotes = false,
- LongSentences = true,
- RepeatedWords = true,
- Spaces = true,
- Matcher = false,
- CorrectNumberSuffix = true,
- },
- isolateEnglish = true,
- },
- },
- })
- lspconfig["pyright"].setup({
- -- capabilities = capabilities,
- settings = {
- python = {
- pythonPath = "/usr/bin/python",
- },
- },
- })
-
- lspconfig["ltex"].setup({
- filetypes = { "latex", "typst", "typ", "bib", "markdown", "plaintex", "tex" },
- settings = {
- ltex = {
- enabled = { "latex", "typst", "typ", "bib", "markdown", "plaintex", "tex" },
- language = { "en-GB", "fr-FR" },
- setenceCacheSize = 2000,
- additionalRules = {
- enablePickyRules = true,
- motherTongue = "fr-FR",
- },
- checkFrequency = "edit",
- },
+ "gopls",
+ "pyright",
+ "clangd",
},
})
end,
diff --git a/lua/ache/plugins/lsp/mason-config.lua b/lua/ache/plugins/lsp/mason.lua
index 6fc48a9..629f2cf 100644
--- a/lua/ache/plugins/lsp/mason-config.lua
+++ b/lua/ache/plugins/lsp/mason.lua
@@ -5,6 +5,11 @@
return {
"williamboman/mason.nvim",
enabled = true,
+
+ dependencies = {
+ "mason-org/mason-registry",
+ "neovim/nvim-lspconfig",
+ },
config = function()
require("mason").setup({
ui = {
diff --git a/lua/ache/plugins/lsp/rust-tools.lua b/lua/ache/plugins/lsp/rust-tools.lua
index 6d76dce..f0d5f93 100644
--- a/lua/ache/plugins/lsp/rust-tools.lua
+++ b/lua/ache/plugins/lsp/rust-tools.lua
@@ -3,7 +3,7 @@
--]
return {
"simrat39/rust-tools.nvim",
- enabled = true,
+ enabled = false,
config = function()
local rt = require("rust-tools")