feat: Updated to new API/syntax for enabling LSPs
This commit is contained in:
parent
992d7227db
commit
d84c28e4c8
|
@ -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)
|
on_init = function(client)
|
||||||
if client.workspace_folders then
|
if client.workspace_folders then
|
||||||
local path = client.workspace_folders[1].name
|
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, {
|
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using
|
|
||||||
-- (most likely LuaJIT in the case of Neovim)
|
|
||||||
version = 'LuaJIT'
|
version = 'LuaJIT'
|
||||||
},
|
},
|
||||||
-- Make the server aware of Neovim runtime files
|
|
||||||
workspace = {
|
workspace = {
|
||||||
checkThirdParty = false,
|
checkThirdParty = false,
|
||||||
library = {
|
library = {
|
||||||
vim.env.VIMRUNTIME
|
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,
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {}
|
Lua = {}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
require('lspconfig').clangd.setup{
|
vim.lsp.enable("clangd")
|
||||||
|
vim.lsp.config("clangd", {
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
cmd = {
|
cmd = {
|
||||||
"clangd",
|
"clangd",
|
||||||
|
@ -72,19 +66,19 @@ require('lspconfig').clangd.setup{
|
||||||
"--completion-style=detailed",
|
"--completion-style=detailed",
|
||||||
"--all-scopes-completion",
|
"--all-scopes-completion",
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
require('lspconfig').pyright.setup{}
|
vim.lsp.enable("pyright")
|
||||||
require('lspconfig').html.setup{}
|
vim.lsp.enable("html")
|
||||||
require('lspconfig').angularls.setup{}
|
vim.lsp.enable("angularls")
|
||||||
require('lspconfig').ts_ls.setup({
|
|
||||||
|
vim.lsp.enable("ts_ls")
|
||||||
|
vim.lsp.config("ts_ls", {
|
||||||
cmd = { "/usr/lib/node_modules/typescript-language-server/lib/cli.mjs", "--stdio" },
|
cmd = { "/usr/lib/node_modules/typescript-language-server/lib/cli.mjs", "--stdio" },
|
||||||
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
|
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
|
||||||
init_options = {
|
init_options = {
|
||||||
-- Required for plugins (even if unused)
|
|
||||||
plugins = {},
|
plugins = {},
|
||||||
},
|
},
|
||||||
-- Ensure tsserver uses project-specific tsconfig.json
|
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
client.server_capabilities.documentFormattingProvider = false -- Optional
|
client.server_capabilities.documentFormattingProvider = false -- Optional
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue