[LSP] Migrate to new config format
This commit is contained in:
parent
17b1d19a93
commit
68c12127c2
@ -8,11 +8,8 @@ return {
|
||||
"mfussenegger/nvim-jdtls",
|
||||
},
|
||||
config = function()
|
||||
-- import lspconfig plugin
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- import cmp-nvim-lsp plugin
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
local lsp = vim.lsp
|
||||
local enable = vim.lsp.enable
|
||||
|
||||
local capabilities = require("lsp-options").capabilities
|
||||
local on_attach = require("lsp-options").on_attach
|
||||
@ -27,7 +24,7 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ Bash │
|
||||
-- └ ┘
|
||||
lspconfig.bashls.setup({
|
||||
lsp.config("bashls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
@ -35,7 +32,7 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ C, Cpp, objc │
|
||||
-- └ ┘
|
||||
lspconfig.clangd.setup({
|
||||
lsp.config("clangd", {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--suggest-missing-includes",
|
||||
@ -49,7 +46,7 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ Rust │
|
||||
-- └ ┘
|
||||
lspconfig.rust_analyzer.setup({
|
||||
lsp.config("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
diagnostics = {
|
||||
@ -64,17 +61,17 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ HTML, CSS, JSON │
|
||||
-- └ ┘
|
||||
lspconfig.cssls.setup({
|
||||
lsp.config("cssls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.html.setup({
|
||||
lsp.config("html", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.jsonls.setup({
|
||||
lsp.config("jsonls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
@ -82,7 +79,7 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ LUA │
|
||||
-- └ ┘
|
||||
lspconfig.lua_ls.setup({
|
||||
lsp.config("lua_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
@ -105,7 +102,7 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ Markdown │
|
||||
-- └ ┘
|
||||
lspconfig.marksman.setup({
|
||||
lsp.config("marksman", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
@ -113,26 +110,34 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ Python │
|
||||
-- └ ┘
|
||||
lspconfig.pyright.setup({
|
||||
lsp.config("pyright", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ Vue, TS, JS, TSX & JSX │
|
||||
-- │ Vue │
|
||||
-- └ ┘
|
||||
local mason_packages = vim.fn.stdpath("data") .. "/mason/packages"
|
||||
local volar_path = mason_packages .. "/vue-language-server/node_modules/@vue/language-server"
|
||||
lspconfig.ts_ls.setup({
|
||||
lsp.config("vue_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = {
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
-- ┌ ┐
|
||||
-- │ TS, JS, TSX, JSX │
|
||||
-- └ ┘
|
||||
lsp.config("ts_ls", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
-- location = "/usr/lib/node_modules/@vue/typescript-plugin",
|
||||
location = volar_path,
|
||||
languages = { "vue" },
|
||||
location = "/usr/lib/node_modules/@vue/typescript-plugin",
|
||||
languages = { "javascript", "typescript", "vue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -148,7 +153,7 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ ASM │
|
||||
-- └ ┘
|
||||
lspconfig.asm_lsp.setup({
|
||||
lsp.config("asm_lsp", {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
@ -156,7 +161,7 @@ return {
|
||||
-- ┌ ┐
|
||||
-- │ LaTeX │
|
||||
-- └ ┘
|
||||
lspconfig.texlab.setup({
|
||||
lsp.config("texlab", {
|
||||
cmd = { "texlab" },
|
||||
filetypes = { "tex", "latex", "bib" },
|
||||
root_dir = function(fname)
|
||||
@ -173,18 +178,35 @@ return {
|
||||
local filename = lspconfutil.path.join(vim.loop.cwd(), fname)
|
||||
return root_pattern(filename) or lspconfutil.path.dirname(filename)
|
||||
end
|
||||
lspconfig.veridian.setup({
|
||||
lsp.config("veridian", {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
root_dir = verilog_root_dir,
|
||||
})
|
||||
|
||||
lspconfig.verible.setup({
|
||||
lsp.config("verible", {
|
||||
-- cmd = { 'verible-verilog-ls', '--rules_config=/home/janis/.config/nvim/util/verible-conf.json' },
|
||||
cmd = { "verible-verilog-ls", "--rules=-no-trailing-spaces", "" },
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
root_dir = verilog_root_dir,
|
||||
})
|
||||
|
||||
-- ╭───────────────────────────────────────────────╮
|
||||
-- │ Enable the configs │
|
||||
-- ╰───────────────────────────────────────────────╯
|
||||
enable("bashls")
|
||||
enable("clangd")
|
||||
enable("rust_analyzer")
|
||||
enable("marksman")
|
||||
enable("vue_ls")
|
||||
enable("ts_ls")
|
||||
enable("texlab")
|
||||
enable("asm_lsp")
|
||||
enable("jsonls")
|
||||
enable("cssls")
|
||||
enable("html")
|
||||
enable("lua_ls")
|
||||
enable("pyright")
|
||||
end,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user