feat: replace coq.nvim with nvim-cmp and luasnip
This commit is contained in:
parent
299c65cd0a
commit
6f1535f83f
3 changed files with 88 additions and 27 deletions
|
@ -1,4 +1,3 @@
|
|||
local coq = require("coq")
|
||||
local lsp_installer = require("nvim-lsp-installer")
|
||||
|
||||
local nvim_runtime_path = vim.split(package.path, ';')
|
||||
|
@ -6,9 +5,9 @@ table.insert(nvim_runtime_path, "lua/?.lua")
|
|||
table.insert(nvim_runtime_path, "lua/?/init.lua")
|
||||
|
||||
local language_servers = {
|
||||
"ansiblels", "bashls", "clangd", "dockerls", "efm", "eslint", "html", "jsonls",
|
||||
"pyright", "rust_analyzer", "sumneko_lua", "svelte", "taplo", "terraformls",
|
||||
"tflint", "tsserver", "volar"
|
||||
"ansiblels", "bashls", "clangd", "dockerls", "efm", "eslint", "html",
|
||||
"jsonls", "pyright", "rust_analyzer", "sumneko_lua", "svelte", "taplo",
|
||||
"terraformls", "tflint", "tsserver", "volar"
|
||||
}
|
||||
|
||||
for _, server_name in pairs(language_servers) do
|
||||
|
@ -22,7 +21,8 @@ end
|
|||
local extra_server_opts = {
|
||||
["efm"] = function(opts)
|
||||
opts.filetypes = {
|
||||
"lua", "html", "javascript", "markdown", "typescript", "typescriptreact"
|
||||
"lua", "html", "javascript", "markdown", "typescript",
|
||||
"typescriptreact"
|
||||
}
|
||||
opts.init_options = {documentFormatting = true}
|
||||
opts.settings = {
|
||||
|
@ -67,11 +67,7 @@ local extra_server_opts = {
|
|||
end,
|
||||
["rust_analyzer"] = function(opts)
|
||||
opts.settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy"
|
||||
}
|
||||
}
|
||||
["rust-analyzer"] = {checkOnSave = {command = "clippy"}}
|
||||
}
|
||||
end,
|
||||
["sumneko_lua"] = function(opts)
|
||||
|
@ -134,10 +130,13 @@ local function custom_on_attach(client, buffer_nr)
|
|||
end
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = coq.lsp_ensure_capabilities({
|
||||
local cmp = require("cmp_nvim_lsp")
|
||||
|
||||
local opts = {
|
||||
on_attach = custom_on_attach,
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
})
|
||||
capabilities = cmp.update_capabilities(vim.lsp.protocol
|
||||
.make_client_capabilities())
|
||||
}
|
||||
|
||||
if extra_server_opts[server.name] then
|
||||
extra_server_opts[server.name](opts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue