diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2025-08-30 19:21:25 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2025-08-30 19:21:25 -0300 |
| commit | ec011dd9c8d4372f4f8566b87981ecc178675adf (patch) | |
| tree | 671b6be58f94528f790f05422bc75a1c3f988172 /lua/pi/lsp/servers | |
| parent | bcb5775dabf2b9144d8a87721d0095d087827f3e (diff) | |
| download | nvim-conf-ec011dd9c8d4372f4f8566b87981ecc178675adf.tar.gz nvim-conf-ec011dd9c8d4372f4f8566b87981ecc178675adf.zip | |
feat(lsp): migración a configuración nativa de LSP en Neovim y mejora de servidores
- Refactoriza la configuración de LSP para usar vim.lsp.start/autocmd nativo, eliminando la dependencia de lspconfig en la mayoría de los servidores.
- Añade funciones auxiliares para detección de directorio raíz y configuración de comandos de servidores.
- Asegura que todos los servidores LSP tengan filetypes y capabilities explícitos para mejor integración.
- Actualiza dependencias de plugins y eventos para soportar el nuevo flujo nativo de LSP.
- Mejora el soporte de inlay hints y agrega un mapeo de teclas para alternar inlay hints.
- Reemplaza el uso de lspconfig.util por vim.fs.find nativo para detección de raíz.
- Marca la integración legacy de mason como obsoleta, favoreciendo la verificación nativa de ejecutables.
- Limpia y estandariza los archivos de configuración de servidores para mayor consistencia.
- Elimina el archivo no utilizado MIGRACION_BLINK.md.
Esta migración permite mejor compatibilidad con Neovim 0.11+, simplifica la gestión de LSP y mejora el rendimiento y la fiabilidad.
Diffstat (limited to 'lua/pi/lsp/servers')
| -rw-r--r-- | lua/pi/lsp/servers/clangd.lua | 1 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/emmet_ls.lua | 11 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/html.lua | 3 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/jsonls.lua | 3 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/kotlin_language_server.lua | 16 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/lua_ls.lua | 25 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/phpactor.lua | 2 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/python.lua | 9 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/smarty_ls.lua | 34 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/texlab.lua | 24 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/ts_ls.lua | 51 |
11 files changed, 111 insertions, 68 deletions
diff --git a/lua/pi/lsp/servers/clangd.lua b/lua/pi/lsp/servers/clangd.lua index e989cf6..3c4ac95 100644 --- a/lua/pi/lsp/servers/clangd.lua +++ b/lua/pi/lsp/servers/clangd.lua @@ -6,6 +6,7 @@ return function(ops) local config = { on_attach = lsp_attach, flags = lsp_flags, + filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" }, capabilities = vim.tbl_deep_extend("force", capabilities, { offsetEncoding = { "utf-16" }, general = { diff --git a/lua/pi/lsp/servers/emmet_ls.lua b/lua/pi/lsp/servers/emmet_ls.lua index e79a052..8d907b4 100644 --- a/lua/pi/lsp/servers/emmet_ls.lua +++ b/lua/pi/lsp/servers/emmet_ls.lua @@ -4,9 +4,10 @@ local lsp_flags = require "pi.lsp.flags" return function(ops) local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) return vim.tbl_extend("force", { - on_attach = lsp_attach, - flags = lsp_flags, - capabilities = capabilities, - filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "blade", "vue" }, - }, ops) + on_attach = lsp_attach, + flags = lsp_flags, + capabilities = capabilities, + -- filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "blade", "vue" }, + filetypes = { "html", "css", "sass", "scss", "less", "blade", "vue" }, + }, ops) end diff --git a/lua/pi/lsp/servers/html.lua b/lua/pi/lsp/servers/html.lua index b20553b..17413ee 100644 --- a/lua/pi/lsp/servers/html.lua +++ b/lua/pi/lsp/servers/html.lua @@ -2,9 +2,12 @@ local lsp_attach = require "pi.lsp.attach" local lsp_flags = require "pi.lsp.flags" return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) local config = { on_attach = lsp_attach, + filetypes = { "html" }, flags = lsp_flags, + capabilities = capabilities, } if vim.fn.executable "html-languageserver" == 1 then config.cmd = { "html-languageserver", "--stdio" } diff --git a/lua/pi/lsp/servers/jsonls.lua b/lua/pi/lsp/servers/jsonls.lua index 3fa16e1..bfc2237 100644 --- a/lua/pi/lsp/servers/jsonls.lua +++ b/lua/pi/lsp/servers/jsonls.lua @@ -2,9 +2,12 @@ local lsp_attach = require "pi.lsp.attach" local lsp_flags = require "pi.lsp.flags" return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) local config = { on_attach = lsp_attach, flags = lsp_flags, + capabilities = capabilities, + filetypes = { "json", "jsonc" }, } if vim.fn.executable "json-languageserver" == 1 then config.cmd = { "json-languageserver", "--stdio" } diff --git a/lua/pi/lsp/servers/kotlin_language_server.lua b/lua/pi/lsp/servers/kotlin_language_server.lua index 59e9406..5ae9022 100644 --- a/lua/pi/lsp/servers/kotlin_language_server.lua +++ b/lua/pi/lsp/servers/kotlin_language_server.lua @@ -1,12 +1,14 @@ local lsp_attach = require "pi.lsp.attach" local lsp_flags = require "pi.lsp.flags" return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) return vim.tbl_extend("force", { - on_attach = lsp_attach, - flags = lsp_flags, - settings = { - ["kotlin-language-server"] = { - } - } - }, ops) + on_attach = lsp_attach, + flags = lsp_flags, + capabilities = capabilities, + filetypes = { "kotlin" }, + settings = { + ["kotlin-language-server"] = {}, + }, + }, ops) end diff --git a/lua/pi/lsp/servers/lua_ls.lua b/lua/pi/lsp/servers/lua_ls.lua index 3975310..c641911 100644 --- a/lua/pi/lsp/servers/lua_ls.lua +++ b/lua/pi/lsp/servers/lua_ls.lua @@ -3,10 +3,25 @@ local lsp_flags = require "pi.lsp.flags" return function(ops) if ops.neodev == true then - require("neodev").setup() + -- Setup neodev with explicit configuration for native LSP + require("neodev").setup { + library = { + enabled = true, + runtime = true, + types = true, + plugins = true, + }, + setup_jsonls = true, + lspconfig = false, -- Don't let neodev override lspconfig setup + } end - + + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) + return vim.tbl_extend("force", { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + capabilities = capabilities, on_attach = lsp_attach, flags = lsp_flags, settings = { @@ -26,6 +41,12 @@ return function(ops) }, hint = { enable = true, + -- Disable some problematic hints that might cause position issues + setType = false, + paramType = true, + paramName = "Disable", -- Can be "All", "Literal", "Disable" + semicolon = "Disable", -- Can be "All", "SameLine", "Disable" + arrayIndex = "Disable", -- Can be "All", "Auto", "Disable" }, completion = { callSnippet = "Replace", diff --git a/lua/pi/lsp/servers/phpactor.lua b/lua/pi/lsp/servers/phpactor.lua index 6196cdb..88c1535 100644 --- a/lua/pi/lsp/servers/phpactor.lua +++ b/lua/pi/lsp/servers/phpactor.lua @@ -51,11 +51,13 @@ local function phpactor_attach(_, bufnr) end return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) return vim.tbl_extend("force", { on_attach = function(client, bufnr) lsp_attach(client, bufnr) phpactor_attach(client, bufnr) end, + capabilities = capabilities, flags = lsp_flags, filetypes = { "php", "blade" }, init_options = { diff --git a/lua/pi/lsp/servers/python.lua b/lua/pi/lsp/servers/python.lua index db561aa..3e79ffd 100644 --- a/lua/pi/lsp/servers/python.lua +++ b/lua/pi/lsp/servers/python.lua @@ -1,16 +1,19 @@ local lsp_attach = require "pi.lsp.attach" local lsp_flags = require "pi.lsp.flags" -return function (ops) +return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) + return vim.tbl_extend("force", { on_attach = lsp_attach, flags = lsp_flags, + capabilities = capabilities, settings = { ["pyright"] = { disableOrganizeImports = false, disableDiagnostics = false, disableLanguageServices = false, typeCheckingMode = "strict", - } - } + }, + }, }, ops) end diff --git a/lua/pi/lsp/servers/smarty_ls.lua b/lua/pi/lsp/servers/smarty_ls.lua index bf29082..88e4b22 100644 --- a/lua/pi/lsp/servers/smarty_ls.lua +++ b/lua/pi/lsp/servers/smarty_ls.lua @@ -2,24 +2,26 @@ local lsp_attach = require "pi.lsp.attach" local lsp_flags = require "pi.lsp.flags" return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) return vim.tbl_extend("force", { - on_attach = lsp_attach, - flags = lsp_flags, - settings = { - css = { - validate = true - }, - smarty = { - pluginDirs = {} - }, - ["smarty_ls"] = { - checkOnSave = { - overrideCommand = { - "smarty-language-server", - "--stdio", - }, + on_attach = lsp_attach, + flags = lsp_flags, + capabilities = capabilities, + settings = { + css = { + validate = true, + }, + smarty = { + pluginDirs = {}, + }, + ["smarty_ls"] = { + checkOnSave = { + overrideCommand = { + "smarty-language-server", + "--stdio", }, }, }, - }, ops) + }, + }, ops) end diff --git a/lua/pi/lsp/servers/texlab.lua b/lua/pi/lsp/servers/texlab.lua index 523628b..810bae4 100644 --- a/lua/pi/lsp/servers/texlab.lua +++ b/lua/pi/lsp/servers/texlab.lua @@ -1,16 +1,18 @@ local lsp_attach = require "pi.lsp.attach" local lsp_flags = require "pi.lsp.flags" return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) return vim.tbl_extend("force", { - on_attach = lsp_attach, - flags = lsp_flags, - settings = { - ["texlab"] = { - latexFormatter = "latexindent", - latexindent = { - modifyLineBreaks = false - } - } - } - }, ops) + on_attach = lsp_attach, + flags = lsp_flags, + capabilities = capabilities, + settings = { + ["texlab"] = { + latexFormatter = "latexindent", + latexindent = { + modifyLineBreaks = false, + }, + }, + }, + }, ops) end diff --git a/lua/pi/lsp/servers/ts_ls.lua b/lua/pi/lsp/servers/ts_ls.lua index c68c894..ad4953b 100644 --- a/lua/pi/lsp/servers/ts_ls.lua +++ b/lua/pi/lsp/servers/ts_ls.lua @@ -2,32 +2,35 @@ local lsp_attach = require "pi.lsp.attach" local lsp_flags = require "pi.lsp.flags" return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) return vim.tbl_extend("force", { - on_attach = lsp_attach, - flags = lsp_flags, - settings = { - typescript = { - inlayHints = { - includeInlayParameterNameHints = "all", - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, + on_attach = lsp_attach, + capabilities = capabilities, + flags = lsp_flags, + filetypes = { "typescriptreact", "javascriptreact", "blade", "vue" }, + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, }, - javascript = { - inlayHints = { - includeInlayParameterNameHints = "all", - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, }, }, - }, ops) + }, + }, ops) end |