Enable lsp install plugin

This commit is contained in:
Oliver Hartmann
2021-11-06 13:03:29 +01:00
parent d92d380f7a
commit d74a4b7576
3 changed files with 122 additions and 3 deletions

View File

@@ -1,6 +1,19 @@
local nvim_lsp = require 'lspconfig'
local utils = require('utils')
local system_name
if vim.fn.has("mac") == 1 then
system_name = "macOS"
elseif vim.fn.has("unix") == 1 then
system_name = "Linux"
elseif vim.fn.has('win32') == 1 then
system_name = "Windows"
else
print("Unsupported system for sumneko")
end
local sumneko_root_path = 'D:/tmp/lua-language-server'
local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server"
-- We use the default settings for ccls and pylsp: the option table can stay empty
-- nvim_lsp.ccls.setup {}
nvim_lsp.pyright.setup{}
@@ -12,7 +25,6 @@ nvim_lsp.groovyls.setup{
cmd = { "java", "-jar", "D:/tmp/groovy-language-server/build/libs/groovy-language-server-all.jar" }
}
-- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' }
@@ -91,7 +103,7 @@ local on_attach = function(client, bufnr)
end
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'pyright', 'cmake', 'jsonls' }
local servers = {'clangd', 'pyright', 'cmake', 'jsonls'}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
@@ -99,6 +111,19 @@ for _, lsp in ipairs(servers) do
}
end
nvim_lsp.sumneko_lua.setup{
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
on_attach = on_attach,
capabilities = capabilities,
}
nvim_lsp.groovyls.setup{
-- Unix
cmd = { "java", "-jar", "D:/tmp/groovy-language-server/build/libs/groovy-language-server-all.jar" },
on_attach = on_attach,
capabilities = capabilities,
}
local signs = { Error = "", Warning = "", Hint = "", Information = "" }
for type, icon in pairs(signs) do
local hl = "LspDiagnosticsSign" .. type