local M = {}
|
|
|
|
local function on_attach(client, bufnr)
|
|
-- Enable completion triggered by <C-X><C-O>
|
|
-- See `:help omnifunc` and `:help ins-completion` for more information.
|
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
|
|
|
-- Use LSP as the handler for formatexpr.
|
|
-- See `:help formatexpr` for more information.
|
|
vim.api.nvim_buf_set_option(0, "formatexpr", "v:lua.vim.lsp.formatexpr()")
|
|
|
|
-- Configure key mappings
|
|
require("config.lsp.keymaps").setup(client, bufnr)
|
|
end
|
|
|
|
local lsp_signature = require "lsp_signature"
|
|
lsp_signature.setup {
|
|
bind = true,
|
|
handler_opts = {
|
|
border = "rounded",
|
|
},
|
|
}
|
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
|
local opts = {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
flags = {
|
|
debounce_text_changes = 150,
|
|
},
|
|
};
|
|
|
|
local servers = {
|
|
gopls = opts,
|
|
html = opts,
|
|
jsonls = opts,
|
|
pyright = opts,
|
|
tsserver = opts,
|
|
vimls = opts,
|
|
dartls = opts,
|
|
dockerls = opts,
|
|
intelephense = opts,
|
|
sqlls = opts,
|
|
vuels = {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
flags = {
|
|
debounce_text_changes = 150,
|
|
},
|
|
init_options = {
|
|
config = {
|
|
vetur = {
|
|
ignoreProjectWarning = true,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
volar = {
|
|
filetypes = {'typescript', 'javascript', 'vue', 'json'},
|
|
init_options = {
|
|
typescript = {
|
|
tsdk = '/usr/lib/node_modules/typescript/lib'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function M.setup()
|
|
for server_name, o in pairs(servers) do
|
|
require('lspconfig')[server_name].setup(o)
|
|
end
|
|
end
|
|
|
|
return M
|