nvim: configure LSP servers for rust, go and perl

This commit is contained in:
tastytea 2022-08-18 01:41:45 +02:00
parent 0d6c6912cd
commit 8c9f70855c
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -82,8 +82,10 @@ vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
})
-- setup servers
local lspconfig = require('lspconfig')
if vim.fn.executable('clangd') > 0 then
require('lspconfig').clangd.setup {
lspconfig.clangd.setup {
cmd = {
'clangd',
'--compile-commands-dir=build',
@ -96,7 +98,7 @@ if vim.fn.executable('clangd') > 0 then
end
if vim.fn.executable('lua-language-server') > 0 then
require('lspconfig').sumneko_lua.setup({
lspconfig.sumneko_lua.setup({
settings = {
Lua = {
runtime = {
@ -123,7 +125,7 @@ if vim.fn.executable('lua-language-server') > 0 then
end
if vim.fn.executable('pylsp') > 0 then
require('lspconfig').pylsp.setup({
lspconfig.pylsp.setup({
settings = {
pylsp = {
}
@ -134,7 +136,7 @@ if vim.fn.executable('pylsp') > 0 then
end
if vim.fn.executable('lemminx') > 0 then
require('lspconfig').lemminx.setup({
lspconfig.lemminx.setup({
filetypes = {
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
},
@ -144,28 +146,50 @@ if vim.fn.executable('lemminx') > 0 then
end
if vim.fn.executable('vscode-html-language-server') > 0 then
require('lspconfig').html.setup({
lspconfig.html.setup({
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('vscode-css-language-server') > 0 then
require('lspconfig').cssls.setup({
lspconfig.cssls.setup({
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('vscode-eslint-language-server') > 0 then
require('lspconfig').eslint.setup({
lspconfig.eslint.setup({
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('vscode-json-language-server') > 0 then
require('lspconfig').jsonls.setup({
lspconfig.jsonls.setup({
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('rust_analyzer') > 0 then
lspconfig.rust_analyzer.setup({
on_attach = on_attach,
capabilities = capabilities
})
end
if vim.fn.executable('gopls') > 0 then
lspconfig.gopls.setup({
on_attach = on_attach,
capabilities = capabilities
})
end
-- binary probably doesn't exist even when installed
if vim.fn.executable('perlls') > 0 then
lspconfig.perlls.setup({
on_attach = on_attach,
capabilities = capabilities
})