[feature] Move common parts of language server setup to lsp/init (#1355)

* moving common parts of language server setup to lsp/init

* fix formatting
This commit is contained in:
Abouzar Parvan 2021-08-20 16:34:02 +04:30 committed by GitHub
parent 85fe093efb
commit 2bcbed1499
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 152 deletions

View file

@ -138,6 +138,17 @@ function M.setup(lang)
if lsp.provider ~= nil and lsp.provider ~= "" then
local lspconfig = require "lspconfig"
if not lsp.setup.on_attach then
lsp.setup.on_attach = M.common_on_attach
end
if not lsp.setup.on_init then
lsp.setup.on_init = M.common_on_init
end
if not lsp.setup.capabilities then
lsp.setup.capabilities = M.common_capabilities()
end
lspconfig[lsp.provider].setup(lsp.setup)
end
end