diff options
author | Michaël Ball <michael.ball@krotosaudio.com> | 2025-05-30 12:22:25 +0100 |
---|---|---|
committer | Michaël Ball <michael.ball@krotosaudio.com> | 2025-05-30 12:22:25 +0100 |
commit | 9a5bd56273908a5fc3d4ef227123b1bb14491852 (patch) | |
tree | 9f22116859ee8deeb2d3549bb69bcf22f60af9be | |
parent | 29a6f0e9a95e22a690298e4a4594fec94e64993d (diff) |
Upgrade to new lsp config spec
-rw-r--r-- | neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua index 19e2eb4..979bffd 100644 --- a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua +++ b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua @@ -15,36 +15,18 @@ return { -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches local servers = { "bashls", "clangd", "cssls", "dockerls", "gopls", "htmx", "jsonls", "marksman", - "ruff", "rust_analyzer", "taplo", "ts_ls", "yamlls" } + "ruff", "rust_analyzer", "taplo", "ts_ls", "ty", "yamlls" } for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { + vim.lsp.config(lsp, { capabilities = capabilities, flags = { debounce_text_changes = 150, - } - } - end - - require 'lspconfig'.basedpyright.setup { - settings = { - basedpyright = { - -- Using Ruff's import organizer - disableOrganizeImports = true, }, - python = { - analysis = { - -- Ignore all files for analysis to exclusively use Ruff for linting - ignore = { '*' }, - }, - }, - }, - capabilities = capabilities, - flags = { - debounce_text_changes = 150, - }, - } + }) + vim.lsp.enable(lsp) + end - require 'lspconfig'.lua_ls.setup { + vim.lsp.config('lua_ls', { on_init = function(client) local path = client.workspace_folders[1].name if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then @@ -60,7 +42,7 @@ return { -- Make the server aware of Neovim runtime files workspace = { checkThirdParty = false, - library = { + library = { vim.env.VIMRUNTIME -- Depending on the usage, you might want to add additional paths here. -- "${3rd}/luv/library" @@ -84,17 +66,21 @@ return { }, capabilities = capabilities, - } + }) + + vim.lsp.enable('lua_ls') - require 'lspconfig'.html.setup { + vim.lsp.config('html', { filetypes = { 'html', 'htmldjango' }, capabilities = capabilities, flags = { debounce_text_changes = 150, }, - } + }) + + vim.lsp.enable('html') - require 'lspconfig'.intelephense.setup { + vim.lsp.config('intelephense', { filetypes = { 'php' }, capabilities = capabilities, flags = { @@ -103,7 +89,9 @@ return { init_options = { licenceKey = '~/.config/intelephense/licence.txt', }, - } + }) + + vim.lsp.enable('intelephense') -- Use LspAttach autocommand to only map the following keys -- after the language server attaches to the current buffer |