feat: Updated to new API/syntax for enabling LSPs

This commit is contained in:
Tristan Russell 2025-08-24 23:09:48 -04:00
parent 992d7227db
commit d84c28e4c8
Signed by: tristanr
GPG Key ID: 4495C92911DF04CA
1 changed files with 12 additions and 18 deletions

View File

@ -29,7 +29,8 @@ cmp.setup({
},
})
require('lspconfig').lua_ls.setup {
vim.lsp.enable("lua_ls")
vim.lsp.config("lua_ls", {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
@ -40,30 +41,23 @@ require('lspconfig').lua_ls.setup {
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT'
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
}
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {}
}
}
})
require('lspconfig').clangd.setup{
vim.lsp.enable("clangd")
vim.lsp.config("clangd", {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
cmd = {
"clangd",
@ -72,19 +66,19 @@ require('lspconfig').clangd.setup{
"--completion-style=detailed",
"--all-scopes-completion",
}
}
})
require('lspconfig').pyright.setup{}
require('lspconfig').html.setup{}
require('lspconfig').angularls.setup{}
require('lspconfig').ts_ls.setup({
vim.lsp.enable("pyright")
vim.lsp.enable("html")
vim.lsp.enable("angularls")
vim.lsp.enable("ts_ls")
vim.lsp.config("ts_ls", {
cmd = { "/usr/lib/node_modules/typescript-language-server/lib/cli.mjs", "--stdio" },
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
init_options = {
-- Required for plugins (even if unused)
plugins = {},
},
-- Ensure tsserver uses project-specific tsconfig.json
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false -- Optional
end