mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-07-21 11:14:42 +02:00
Check lsp client is active for all language files (#790)
This commit is contained in:
parent
9233611bdc
commit
53fed9d655
33 changed files with 412 additions and 291 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "clangd" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local clangd_flags = { "--background-index" }
|
local clangd_flags = { "--background-index" }
|
||||||
|
|
||||||
if O.lang.clang.cross_file_rename then
|
if O.lang.clang.cross_file_rename then
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "cmake" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").cmake.setup {
|
require("lspconfig").cmake.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" },
|
cmd = { DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server" },
|
||||||
on_attach = require("lsp").common_on_attach,
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "omnisharp" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- C# language server (csharp/OmniSharp) setup
|
-- C# language server (csharp/OmniSharp) setup
|
||||||
require("lspconfig").omnisharp.setup{
|
require("lspconfig").omnisharp.setup {
|
||||||
on_attach = require("lsp").common_on_attach,
|
on_attach = require("lsp").common_on_attach,
|
||||||
root_dir = require("lspconfig").util.root_pattern(".sln",".git"),
|
root_dir = require("lspconfig").util.root_pattern(".sln", ".git"),
|
||||||
cmd = { DATA_PATH .. "/lspinstall/csharp/omnisharp/run", "--languageserver", "--hostPID", tostring(vim.fn.getpid()) },
|
cmd = { DATA_PATH .. "/lspinstall/csharp/omnisharp/run", "--languageserver", "--hostPID", tostring(vim.fn.getpid()) },
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
-- npm install -g vscode-css-languageserver-bin
|
if not require("lv-utils").check_lsp_client_active "cssls" then
|
||||||
require("lspconfig").cssls.setup {
|
-- npm install -g vscode-css-languageserver-bin
|
||||||
cmd = {
|
require("lspconfig").cssls.setup {
|
||||||
"node",
|
cmd = {
|
||||||
DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
|
"node",
|
||||||
"--stdio",
|
DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
|
||||||
},
|
"--stdio",
|
||||||
on_attach = require("lsp").common_on_attach,
|
},
|
||||||
}
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
vim.cmd "setl ts=2 sw=2"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "dartls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").dartls.setup {
|
require("lspconfig").dartls.setup {
|
||||||
cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
|
cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
|
||||||
on_attach = require("lsp").common_on_attach,
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "dockerls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- npm install -g dockerfile-language-server-nodejs
|
-- npm install -g dockerfile-language-server-nodejs
|
||||||
require("lspconfig").dockerls.setup {
|
require("lspconfig").dockerls.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" },
|
cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" },
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "elixirls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").elixirls.setup {
|
require("lspconfig").elixirls.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "elmls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").elmls.setup {
|
require("lspconfig").elmls.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-language-server" },
|
cmd = { DATA_PATH .. "/lspinstall/elm/node_modules/.bin/elm-language-server" },
|
||||||
init_options = {
|
init_options = {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "elixirls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- TODO Remove this at some point
|
-- TODO Remove this at some point
|
||||||
require("lspconfig").elixirls.setup {
|
require("lspconfig").elixirls.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
require("lspconfig").gopls.setup {
|
if not require("lv-utils").check_lsp_client_active "gopls" then
|
||||||
cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
|
require("lspconfig").gopls.setup {
|
||||||
settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
|
cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
|
||||||
root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
|
settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
|
||||||
init_options = { usePlaceholders = true, completeUnimported = true },
|
root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
|
||||||
on_attach = require("lsp").common_on_attach,
|
init_options = { usePlaceholders = true, completeUnimported = true },
|
||||||
}
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
vim.opt_local.tabstop = 4
|
vim.opt_local.tabstop = 4
|
||||||
vim.opt_local.shiftwidth = 4
|
vim.opt_local.shiftwidth = 4
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "graphql" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- npm install -g graphql-language-service-cli
|
-- npm install -g graphql-language-service-cli
|
||||||
require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach }
|
require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach }
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
-- npm install -g vscode-html-languageserver-bin
|
if not require("lv-utils").check_lsp_client_active "html" then
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- npm install -g vscode-html-languageserver-bin
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
require("lspconfig").html.setup {
|
||||||
|
cmd = {
|
||||||
|
"node",
|
||||||
|
DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
|
||||||
|
"--stdio",
|
||||||
|
},
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").html.setup {
|
|
||||||
cmd = {
|
|
||||||
"node",
|
|
||||||
DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
|
|
||||||
"--stdio",
|
|
||||||
},
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
vim.cmd "setl ts=2 sw=2"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "jdtls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local util = require "lspconfig/util"
|
local util = require "lspconfig/util"
|
||||||
-- In Vimscript
|
-- In Vimscript
|
||||||
-- augroup lsp
|
-- augroup lsp
|
||||||
|
|
|
@ -1,38 +1,41 @@
|
||||||
-- npm install -g typescript typescript-language-server
|
if not require("lv-utils").check_lsp_client_active "tsserver" then
|
||||||
-- require'snippets'.use_suggested_mappings()
|
-- npm install -g typescript typescript-language-server
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- require'snippets'.use_suggested_mappings()
|
||||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- local on_attach_common = function(client)
|
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||||
-- print("LSP Initialized")
|
-- local on_attach_common = function(client)
|
||||||
-- require'completion'.on_attach(client)
|
-- print("LSP Initialized")
|
||||||
-- require'illuminate'.on_attach(client)
|
-- require'completion'.on_attach(client)
|
||||||
-- end
|
-- require'illuminate'.on_attach(client)
|
||||||
require("lspconfig").tsserver.setup {
|
-- end
|
||||||
cmd = {
|
require("lspconfig").tsserver.setup {
|
||||||
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
cmd = {
|
||||||
"--stdio",
|
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
||||||
},
|
"--stdio",
|
||||||
filetypes = {
|
},
|
||||||
"javascript",
|
filetypes = {
|
||||||
"javascriptreact",
|
"javascript",
|
||||||
"javascript.jsx",
|
"javascriptreact",
|
||||||
"typescript",
|
"javascript.jsx",
|
||||||
"typescriptreact",
|
"typescript",
|
||||||
"typescript.tsx",
|
"typescriptreact",
|
||||||
},
|
"typescript.tsx",
|
||||||
on_attach = require("lsp").tsserver_on_attach,
|
},
|
||||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
on_attach = require("lsp").tsserver_on_attach,
|
||||||
-- on_attach = require'lsp'.common_on_attach,
|
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||||
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
-- on_attach = require'lsp'.common_on_attach,
|
||||||
settings = { documentFormatting = false },
|
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||||
handlers = {
|
settings = { documentFormatting = false },
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
handlers = {
|
||||||
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
signs = O.lang.tsserver.diagnostics.signs,
|
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
||||||
underline = O.lang.tsserver.diagnostics.underline,
|
signs = O.lang.tsserver.diagnostics.signs,
|
||||||
update_in_insert = true,
|
underline = O.lang.tsserver.diagnostics.underline,
|
||||||
}),
|
update_in_insert = true,
|
||||||
},
|
}),
|
||||||
}
|
},
|
||||||
require("lsp.ts-fmt-lint").setup()
|
}
|
||||||
|
require("lsp.ts-fmt-lint").setup()
|
||||||
|
end
|
||||||
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
vim.cmd "setl ts=2 sw=2"
|
||||||
|
|
|
@ -1,38 +1,41 @@
|
||||||
-- npm install -g typescript typescript-language-server
|
if not require("lv-utils").check_lsp_client_active "tsserver" then
|
||||||
-- require'snippets'.use_suggested_mappings()
|
-- npm install -g typescript typescript-language-server
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- require'snippets'.use_suggested_mappings()
|
||||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- local on_attach_common = function(client)
|
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||||
-- print("LSP Initialized")
|
-- local on_attach_common = function(client)
|
||||||
-- require'completion'.on_attach(client)
|
-- print("LSP Initialized")
|
||||||
-- require'illuminate'.on_attach(client)
|
-- require'completion'.on_attach(client)
|
||||||
-- end
|
-- require'illuminate'.on_attach(client)
|
||||||
require("lspconfig").tsserver.setup {
|
-- end
|
||||||
cmd = {
|
require("lspconfig").tsserver.setup {
|
||||||
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
cmd = {
|
||||||
"--stdio",
|
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
||||||
},
|
"--stdio",
|
||||||
filetypes = {
|
},
|
||||||
"javascript",
|
filetypes = {
|
||||||
"javascriptreact",
|
"javascript",
|
||||||
"javascript.jsx",
|
"javascriptreact",
|
||||||
"typescript",
|
"javascript.jsx",
|
||||||
"typescriptreact",
|
"typescript",
|
||||||
"typescript.tsx",
|
"typescriptreact",
|
||||||
},
|
"typescript.tsx",
|
||||||
on_attach = require("lsp").tsserver_on_attach,
|
},
|
||||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
on_attach = require("lsp").tsserver_on_attach,
|
||||||
-- on_attach = require'lsp'.common_on_attach,
|
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||||
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
-- on_attach = require'lsp'.common_on_attach,
|
||||||
settings = { documentFormatting = false },
|
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||||
handlers = {
|
settings = { documentFormatting = false },
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
handlers = {
|
||||||
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
signs = O.lang.tsserver.diagnostics.signs,
|
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
||||||
underline = O.lang.tsserver.diagnostics.underline,
|
signs = O.lang.tsserver.diagnostics.signs,
|
||||||
update_in_insert = true,
|
underline = O.lang.tsserver.diagnostics.underline,
|
||||||
}),
|
update_in_insert = true,
|
||||||
},
|
}),
|
||||||
}
|
},
|
||||||
require("lsp.ts-fmt-lint").setup()
|
}
|
||||||
|
require("lsp.ts-fmt-lint").setup()
|
||||||
|
end
|
||||||
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
vim.cmd "setl ts=2 sw=2"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "jsonls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- npm install -g vscode-json-languageserver
|
-- npm install -g vscode-json-languageserver
|
||||||
require("lspconfig").jsonls.setup {
|
require("lspconfig").jsonls.setup {
|
||||||
cmd = {
|
cmd = {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "kotlin_language_server" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
--- default config for gradle-projects of the
|
--- default config for gradle-projects of the
|
||||||
--- kotlin-language-server: https://github.com/fwcd/kotlin-language-server
|
--- kotlin-language-server: https://github.com/fwcd/kotlin-language-server
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,34 +1,37 @@
|
||||||
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
if not require("lv-utils").check_lsp_client_active "sumneko_lua" then
|
||||||
local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
|
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
||||||
local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
|
local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
|
||||||
|
local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
|
||||||
|
|
||||||
require("lspconfig").sumneko_lua.setup {
|
require("lspconfig").sumneko_lua.setup {
|
||||||
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
|
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
|
||||||
on_attach = require("lsp").common_on_attach,
|
on_attach = require("lsp").common_on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
version = "LuaJIT",
|
version = "LuaJIT",
|
||||||
-- Setup your lua path
|
-- Setup your lua path
|
||||||
path = vim.split(package.path, ";"),
|
path = vim.split(package.path, ";"),
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = { "vim" },
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
library = {
|
library = {
|
||||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||||
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||||
|
},
|
||||||
|
maxPreload = 100000,
|
||||||
|
preloadFileSize = 1000,
|
||||||
},
|
},
|
||||||
maxPreload = 100000,
|
|
||||||
preloadFileSize = 1000,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
end
|
||||||
|
|
||||||
if O.lang.lua.autoformat then
|
if O.lang.lua.autoformat then
|
||||||
require("lv-utils").define_augroups {
|
require("lv-utils").define_augroups {
|
||||||
_lua_autoformat = {
|
_lua_autoformat = {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "intelephense" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").intelephense.setup {
|
require("lspconfig").intelephense.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
|
cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
|
||||||
on_attach = require("lsp").common_on_attach,
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
|
|
@ -20,46 +20,50 @@ if O.lang.python.isort then
|
||||||
table.insert(python_arguments, isort)
|
table.insert(python_arguments, isort)
|
||||||
end
|
end
|
||||||
|
|
||||||
require("lspconfig").efm.setup {
|
if not require("lv-utils").check_lsp_client_active "efm" then
|
||||||
-- init_options = {initializationOptions},
|
require("lspconfig").efm.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
-- init_options = {initializationOptions},
|
||||||
init_options = { documentFormatting = true, codeAction = false },
|
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
||||||
filetypes = { "python" },
|
init_options = { documentFormatting = true, codeAction = false },
|
||||||
settings = {
|
filetypes = { "python" },
|
||||||
rootMarkers = { ".git/", "requirements.txt" },
|
settings = {
|
||||||
languages = {
|
rootMarkers = { ".git/", "requirements.txt" },
|
||||||
python = python_arguments,
|
languages = {
|
||||||
},
|
python = python_arguments,
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- npm i -g pyright
|
|
||||||
require("lspconfig").pyright.setup {
|
|
||||||
cmd = {
|
|
||||||
DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver",
|
|
||||||
"--stdio",
|
|
||||||
},
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
handlers = {
|
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = O.lang.python.diagnostics.virtual_text,
|
|
||||||
signs = O.lang.python.diagnostics.signs,
|
|
||||||
underline = O.lang.python.diagnostics.underline,
|
|
||||||
update_in_insert = true,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
settings = {
|
|
||||||
python = {
|
|
||||||
analysis = {
|
|
||||||
typeCheckingMode = O.lang.python.analysis.type_checking,
|
|
||||||
autoSearchPaths = O.lang.python.analysis.auto_search_paths,
|
|
||||||
useLibraryCodeForTypes = O.lang.python.analysis.use_library_code_types,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
end
|
||||||
|
|
||||||
|
if not require("lv-utils").check_lsp_client_active "pyright" then
|
||||||
|
-- npm i -g pyright
|
||||||
|
require("lspconfig").pyright.setup {
|
||||||
|
cmd = {
|
||||||
|
DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver",
|
||||||
|
"--stdio",
|
||||||
|
},
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = O.lang.python.diagnostics.virtual_text,
|
||||||
|
signs = O.lang.python.diagnostics.signs,
|
||||||
|
underline = O.lang.python.diagnostics.underline,
|
||||||
|
update_in_insert = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
typeCheckingMode = O.lang.python.analysis.type_checking,
|
||||||
|
autoSearchPaths = O.lang.python.analysis.auto_search_paths,
|
||||||
|
useLibraryCodeForTypes = O.lang.python.analysis.use_library_code_types,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
if O.plugin.debug.active and O.plugin.dap_install.active then
|
if O.plugin.debug.active and O.plugin.dap_install.active then
|
||||||
local dap_install = require("dap-install")
|
local dap_install = require "dap-install"
|
||||||
dap_install.config("python_dbg", {})
|
dap_install.config("python_dbg", {})
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "solargraph" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- If you are using rvm, make sure to change below configuration
|
-- If you are using rvm, make sure to change below configuration
|
||||||
require("lspconfig").solargraph.setup {
|
require("lspconfig").solargraph.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio" },
|
cmd = { DATA_PATH .. "/lspinstall/ruby/solargraph/solargraph", "stdio" },
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "rust_analyzer" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if O.lang.rust.rust_tools.active then
|
if O.lang.rust.rust_tools.active then
|
||||||
local opts = {
|
local opts = {
|
||||||
tools = { -- rust-tools options
|
tools = { -- rust-tools options
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
-- npm i -g bash-language-server
|
if not require("lv-utils").check_lsp_client_active "bashls" then
|
||||||
require("lspconfig").bashls.setup {
|
-- npm i -g bash-language-server
|
||||||
cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
|
require("lspconfig").bashls.setup {
|
||||||
on_attach = require("lsp").common_on_attach,
|
cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
|
||||||
filetypes = { "sh", "zsh" },
|
on_attach = require("lsp").common_on_attach,
|
||||||
}
|
filetypes = { "sh", "zsh" },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
-- sh
|
-- sh
|
||||||
local sh_arguments = {}
|
local sh_arguments = {}
|
||||||
|
@ -19,15 +21,17 @@ if O.lang.sh.linter == "shellcheck" then
|
||||||
table.insert(sh_arguments, shellcheck)
|
table.insert(sh_arguments, shellcheck)
|
||||||
end
|
end
|
||||||
|
|
||||||
require("lspconfig").efm.setup {
|
if not require("lv-utils").check_lsp_client_active "efm" then
|
||||||
-- init_options = {initializationOptions},
|
require("lspconfig").efm.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
-- init_options = {initializationOptions},
|
||||||
init_options = { documentFormatting = true, codeAction = false },
|
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
||||||
filetypes = { "sh" },
|
init_options = { documentFormatting = true, codeAction = false },
|
||||||
settings = {
|
filetypes = { "sh" },
|
||||||
rootMarkers = { ".git/" },
|
settings = {
|
||||||
languages = {
|
rootMarkers = { ".git/" },
|
||||||
sh = sh_arguments,
|
languages = {
|
||||||
|
sh = sh_arguments,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
end
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "texlab" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").texlab.setup {
|
require("lspconfig").texlab.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },
|
cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },
|
||||||
on_attach = require("lsp").common_on_attach,
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "terraformls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("lspconfig").terraformls.setup {
|
require("lspconfig").terraformls.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
|
cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
|
||||||
on_attach = require("lsp").common_on_attach,
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
|
|
@ -1,38 +1,41 @@
|
||||||
-- npm install -g typescript typescript-language-server
|
if not require("lv-utils").check_lsp_client_active "tsserver" then
|
||||||
-- require'snippets'.use_suggested_mappings()
|
-- npm install -g typescript typescript-language-server
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- require'snippets'.use_suggested_mappings()
|
||||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- local on_attach_common = function(client)
|
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||||
-- print("LSP Initialized")
|
-- local on_attach_common = function(client)
|
||||||
-- require'completion'.on_attach(client)
|
-- print("LSP Initialized")
|
||||||
-- require'illuminate'.on_attach(client)
|
-- require'completion'.on_attach(client)
|
||||||
-- end
|
-- require'illuminate'.on_attach(client)
|
||||||
require("lspconfig").tsserver.setup {
|
-- end
|
||||||
cmd = {
|
require("lspconfig").tsserver.setup {
|
||||||
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
cmd = {
|
||||||
"--stdio",
|
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
||||||
},
|
"--stdio",
|
||||||
filetypes = {
|
},
|
||||||
"javascript",
|
filetypes = {
|
||||||
"javascriptreact",
|
"javascript",
|
||||||
"javascript.jsx",
|
"javascriptreact",
|
||||||
"typescript",
|
"javascript.jsx",
|
||||||
"typescriptreact",
|
"typescript",
|
||||||
"typescript.tsx",
|
"typescriptreact",
|
||||||
},
|
"typescript.tsx",
|
||||||
on_attach = require("lsp").tsserver_on_attach,
|
},
|
||||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
on_attach = require("lsp").tsserver_on_attach,
|
||||||
-- on_attach = require'lsp'.common_on_attach,
|
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||||
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
-- on_attach = require'lsp'.common_on_attach,
|
||||||
settings = { documentFormatting = false },
|
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||||
handlers = {
|
settings = { documentFormatting = false },
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
handlers = {
|
||||||
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
signs = O.lang.tsserver.diagnostics.signs,
|
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
||||||
underline = O.lang.tsserver.diagnostics.underline,
|
signs = O.lang.tsserver.diagnostics.signs,
|
||||||
update_in_insert = true,
|
underline = O.lang.tsserver.diagnostics.underline,
|
||||||
}),
|
update_in_insert = true,
|
||||||
},
|
}),
|
||||||
}
|
},
|
||||||
require("lsp.ts-fmt-lint").setup()
|
}
|
||||||
|
require("lsp.ts-fmt-lint").setup()
|
||||||
|
end
|
||||||
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
vim.cmd "setl ts=2 sw=2"
|
||||||
|
|
|
@ -1,38 +1,41 @@
|
||||||
-- npm install -g typescript typescript-language-server
|
if not require("lv-utils").check_lsp_client_active "tsserver" then
|
||||||
-- require'snippets'.use_suggested_mappings()
|
-- npm install -g typescript typescript-language-server
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- require'snippets'.use_suggested_mappings()
|
||||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- local on_attach_common = function(client)
|
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||||
-- print("LSP Initialized")
|
-- local on_attach_common = function(client)
|
||||||
-- require'completion'.on_attach(client)
|
-- print("LSP Initialized")
|
||||||
-- require'illuminate'.on_attach(client)
|
-- require'completion'.on_attach(client)
|
||||||
-- end
|
-- require'illuminate'.on_attach(client)
|
||||||
require("lspconfig").tsserver.setup {
|
-- end
|
||||||
cmd = {
|
require("lspconfig").tsserver.setup {
|
||||||
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
cmd = {
|
||||||
"--stdio",
|
DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
|
||||||
},
|
"--stdio",
|
||||||
filetypes = {
|
},
|
||||||
"javascript",
|
filetypes = {
|
||||||
"javascriptreact",
|
"javascript",
|
||||||
"javascript.jsx",
|
"javascriptreact",
|
||||||
"typescript",
|
"javascript.jsx",
|
||||||
"typescriptreact",
|
"typescript",
|
||||||
"typescript.tsx",
|
"typescriptreact",
|
||||||
},
|
"typescript.tsx",
|
||||||
on_attach = require("lsp").tsserver_on_attach,
|
},
|
||||||
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
on_attach = require("lsp").tsserver_on_attach,
|
||||||
-- on_attach = require'lsp'.common_on_attach,
|
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||||
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
-- on_attach = require'lsp'.common_on_attach,
|
||||||
settings = { documentFormatting = false },
|
root_dir = require("lspconfig/util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||||
handlers = {
|
settings = { documentFormatting = false },
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
handlers = {
|
||||||
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
signs = O.lang.tsserver.diagnostics.signs,
|
virtual_text = O.lang.tsserver.diagnostics.virtual_text,
|
||||||
underline = O.lang.tsserver.diagnostics.underline,
|
signs = O.lang.tsserver.diagnostics.signs,
|
||||||
update_in_insert = true,
|
underline = O.lang.tsserver.diagnostics.underline,
|
||||||
}),
|
update_in_insert = true,
|
||||||
},
|
}),
|
||||||
}
|
},
|
||||||
require("lsp.ts-fmt-lint").setup()
|
}
|
||||||
|
require("lsp.ts-fmt-lint").setup()
|
||||||
|
end
|
||||||
|
|
||||||
vim.cmd "setl ts=2 sw=2"
|
vim.cmd "setl ts=2 sw=2"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "vimls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- npm install -g vim-language-server
|
-- npm install -g vim-language-server
|
||||||
require("lspconfig").vimls.setup {
|
require("lspconfig").vimls.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" },
|
cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" },
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "vuels" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Vue language server configuration (vetur)
|
-- Vue language server configuration (vetur)
|
||||||
require("lspconfig").vuels.setup {
|
require("lspconfig").vuels.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio" },
|
cmd = { DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio" },
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if require("lv-utils").check_lsp_client_active "yamlls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- npm install -g yaml-language-server
|
-- npm install -g yaml-language-server
|
||||||
require("lspconfig").yamlls.setup {
|
require("lspconfig").yamlls.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio" },
|
cmd = { DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio" },
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
-- Because lspinstall don't support zig yet,
|
if not require("lv-utils").check_lsp_client_active "zls" then
|
||||||
-- So we need zls preset in global lib
|
-- Because lspinstall don't support zig yet,
|
||||||
-- Further custom install zls in
|
-- So we need zls preset in global lib
|
||||||
-- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
|
-- Further custom install zls in
|
||||||
require("lspconfig").zls.setup {
|
-- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
|
||||||
root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
|
require("lspconfig").zls.setup {
|
||||||
on_attach = require("lsp").common_on_attach,
|
root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
|
||||||
}
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
require("lv-utils").define_augroups {
|
require("lv-utils").define_augroups {
|
||||||
_zig_autoformat = {
|
_zig_autoformat = {
|
||||||
{ "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' },
|
{ "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' },
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
-- npm i -g bash-language-server
|
if not require("lv-utils").check_lsp_client_active "bashls" then
|
||||||
require("lspconfig").bashls.setup {
|
-- npm i -g bash-language-server
|
||||||
cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
|
require("lspconfig").bashls.setup {
|
||||||
on_attach = require("lsp").common_on_attach,
|
cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
|
||||||
filetypes = { "sh", "zsh" },
|
on_attach = require("lsp").common_on_attach,
|
||||||
}
|
filetypes = { "sh", "zsh" },
|
||||||
|
}
|
||||||
-- npm i -g bash-language-server
|
end
|
||||||
require("lspconfig").bashls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
filetypes = { "sh", "zsh" },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- sh
|
-- sh
|
||||||
local sh_arguments = {}
|
local sh_arguments = {}
|
||||||
|
@ -24,15 +19,17 @@ if O.lang.sh.linter == "shellcheck" then
|
||||||
table.insert(sh_arguments, shellcheck)
|
table.insert(sh_arguments, shellcheck)
|
||||||
end
|
end
|
||||||
|
|
||||||
require("lspconfig").efm.setup {
|
if not require("lv-utils").check_lsp_client_active "efm" then
|
||||||
-- init_options = {initializationOptions},
|
require("lspconfig").efm.setup {
|
||||||
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
-- init_options = {initializationOptions},
|
||||||
init_options = { documentFormatting = true, codeAction = false },
|
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
||||||
filetypes = { "zsh" },
|
init_options = { documentFormatting = true, codeAction = false },
|
||||||
settings = {
|
filetypes = { "zsh" },
|
||||||
rootMarkers = { ".git/" },
|
settings = {
|
||||||
languages = {
|
rootMarkers = { ".git/" },
|
||||||
sh = sh_arguments,
|
languages = {
|
||||||
|
sh = sh_arguments,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
end
|
||||||
|
|
|
@ -8,6 +8,16 @@ function lv_utils.reload_lv_config()
|
||||||
vim.cmd ":PackerInstall"
|
vim.cmd ":PackerInstall"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function lv_utils.check_lsp_client_active(name)
|
||||||
|
local clients = vim.lsp.get_active_clients()
|
||||||
|
for _, client in pairs(clients) do
|
||||||
|
if client.name == name then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function lv_utils.define_augroups(definitions) -- {{{1
|
function lv_utils.define_augroups(definitions) -- {{{1
|
||||||
-- Create autocommand groups based on the passed definitions
|
-- Create autocommand groups based on the passed definitions
|
||||||
--
|
--
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue