2021-11-05 23:25:36 +01:00
|
|
|
vim.lsp.set_log_level("info")
|
|
|
|
|
|
|
|
|
|
local null_ls = require("null-ls")
|
|
|
|
|
local sources = {
|
|
|
|
|
--null_ls.builtins.code_actions.gitsigns,
|
|
|
|
|
null_ls.builtins.formatting.stylua,
|
|
|
|
|
null_ls.builtins.formatting.trim_whitespace,
|
|
|
|
|
null_ls.builtins.diagnostics.shellcheck,
|
|
|
|
|
null_ls.builtins.diagnostics.codespell,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
null_ls.config({ sources = sources })
|
2021-06-20 18:55:56 +02:00
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
local lsp_status = require("lsp-status")
|
2021-06-20 18:55:56 +02:00
|
|
|
lsp_status.register_progress()
|
|
|
|
|
|
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
2021-11-05 23:28:40 +01:00
|
|
|
capabilities = vim.tbl_extend("keep", capabilities, lsp_status.capabilities)
|
2021-06-20 18:55:56 +02:00
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
require("lspkind").init({})
|
|
|
|
|
local lspconfig = require("lspconfig")
|
|
|
|
|
local configs = require("lspconfig/configs")
|
|
|
|
|
local util = require("lspconfig/util")
|
2021-06-20 18:55:56 +02:00
|
|
|
|
2021-09-25 19:15:14 +02:00
|
|
|
if not lspconfig.rsh_lsp then
|
|
|
|
|
configs.rsh_lsp = {
|
2021-11-05 23:28:40 +01:00
|
|
|
default_config = {
|
|
|
|
|
cmd = { "rsh-lsp" },
|
|
|
|
|
filetypes = { "rsh" },
|
2021-09-25 19:15:14 +02:00
|
|
|
root_dir = util.path.dirname,
|
2021-11-05 23:28:40 +01:00
|
|
|
settings = {},
|
|
|
|
|
},
|
|
|
|
|
}
|
2021-09-25 19:15:14 +02:00
|
|
|
end
|
|
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
lspconfig["null-ls"].setup({
|
|
|
|
|
on_attach = lsp_status.on_attach,
|
|
|
|
|
})
|
|
|
|
|
lspconfig.rust_analyzer.setup({
|
|
|
|
|
on_attach = lsp_status.on_attach,
|
2021-06-20 18:55:56 +02:00
|
|
|
settings = {
|
|
|
|
|
["rust-analyzer"] = {
|
2021-11-05 23:28:40 +01:00
|
|
|
procMacro = {
|
|
|
|
|
enable = true,
|
2021-06-29 13:41:53 +02:00
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
cargo = {
|
2021-06-29 13:41:53 +02:00
|
|
|
allFeatures = true,
|
2021-11-05 23:28:40 +01:00
|
|
|
loadOutDirsFromCheck = true,
|
2021-06-20 18:55:56 +02:00
|
|
|
},
|
|
|
|
|
updates = {
|
2021-11-05 23:28:40 +01:00
|
|
|
channel = "nightly",
|
2021-06-20 18:55:56 +02:00
|
|
|
},
|
2021-11-05 23:28:40 +01:00
|
|
|
},
|
2021-06-20 18:55:56 +02:00
|
|
|
},
|
2021-11-05 23:28:40 +01:00
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
|
|
|
|
lspconfig.jsonls.setup({
|
|
|
|
|
on_attach = lsp_status.on_attach,
|
2021-06-20 18:55:56 +02:00
|
|
|
cmd = { "json-languageserver", "--stdio" },
|
2021-11-05 23:28:40 +01:00
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
|
|
|
|
lspconfig.bashls.setup({
|
|
|
|
|
on_attach = lsp_status.on_attach,
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
|
|
|
|
lspconfig.rsh_lsp.setup({
|
|
|
|
|
on_attach = lsp_status.on_attach,
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
|
|
|
|
lspconfig.clangd.setup({
|
2021-06-20 18:55:56 +02:00
|
|
|
on_attach = lsp_status.on_attach,
|
|
|
|
|
handlers = lsp_status.extensions.clangd.setup(),
|
2021-11-05 23:28:40 +01:00
|
|
|
init_options = { clangdFileStatus = true },
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
|
|
|
|
lspconfig.texlab.setup({
|
2021-06-20 18:55:56 +02:00
|
|
|
on_attach = lsp_status.on_attach,
|
2021-11-05 23:28:40 +01:00
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2021-06-20 18:55:56 +02:00
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
lspconfig.rnix.setup({
|
2021-06-20 18:55:56 +02:00
|
|
|
on_attach = lsp_status.on_attach,
|
2021-11-05 23:28:40 +01:00
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2021-06-20 18:55:56 +02:00
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
lspconfig.dartls.setup({
|
2021-06-29 13:41:53 +02:00
|
|
|
on_attach = lsp_status.on_attach,
|
|
|
|
|
capabilities = capabilities,
|
2021-11-05 23:28:40 +01:00
|
|
|
cmd = { "dart", vim.fn.expand("$DART_SDK") .. "/snapshots/analysis_server.dart.snapshot", "--lsp" },
|
|
|
|
|
})
|
2021-06-29 13:41:53 +02:00
|
|
|
|
2021-11-05 23:28:40 +01:00
|
|
|
lspconfig.vuels.setup({
|
2021-06-29 13:41:53 +02:00
|
|
|
on_attach = lsp_status.on_attach,
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
config = {
|
|
|
|
|
vetur = {
|
|
|
|
|
defaultFormatter = {
|
|
|
|
|
js = "prettier",
|
|
|
|
|
ts = "prettier",
|
2021-11-05 23:28:40 +01:00
|
|
|
html = "prettier",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|