mirror of
https://github.com/zoriya/dotfiles.git
synced 2025-12-06 06:36:17 +00:00
Update lsp setup
This commit is contained in:
@@ -21,3 +21,5 @@ alias "o"="l"
|
||||
alias "k"="l"
|
||||
|
||||
alias ls="exa --group"
|
||||
alias lg="exa --git-ignore"
|
||||
alias llg="exa -l --git-ignore"
|
||||
|
||||
@@ -1,65 +1,25 @@
|
||||
local ok, lspconfig = pcall(require, "lspconfig")
|
||||
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
|
||||
if not status_ok then
|
||||
if not status_ok or not ok then
|
||||
return
|
||||
end
|
||||
|
||||
local server_settings = {
|
||||
omnisharp = {
|
||||
handlers = {
|
||||
["textDocument/definition"] = require('omnisharp_extended').handler,
|
||||
},
|
||||
cmd_env = {
|
||||
["OMNISHARP_FormattingOptions:EnableEditorConfigSupport"] = true,
|
||||
["OMNISHARP_RoslynExtensionsOptions:enableAnalyzersSupport"] = true,
|
||||
["OMNISHARP_RoslynExtensionsOptions:enableImportCompletion"] = true,
|
||||
["OMNISHARP_RoslynExtensionsOptions:enableDecompilationSupport"] = true,
|
||||
["OMNISHARP_msbuild:EnablePackageAutoRestore"] = true,
|
||||
},
|
||||
},
|
||||
jsonls = {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require('schemastore').json.schemas(),
|
||||
},
|
||||
},
|
||||
},
|
||||
sumneko_lua = {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
robotframework_ls = {
|
||||
settings = {
|
||||
robot = {
|
||||
codeFormatter = "robotidy",
|
||||
variables = {
|
||||
RESOURCES = vim.fn.getcwd() .. "/tests/robot/",
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
ltex = {
|
||||
settings = {
|
||||
ltex = {
|
||||
dictionary = {
|
||||
en = { ":~/.cache/nvim/ltex.dictionary.en-us.txt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
local util = require "lspconfig.util"
|
||||
util.on_setup = util.add_hook_after(util.on_setup, function(config)
|
||||
local opts = {
|
||||
on_attach = require("lsp.handlers").on_attach,
|
||||
capabilities = require("lsp.handlers").capabilities,
|
||||
}
|
||||
|
||||
lsp_installer.settings({
|
||||
if config.on_attach then
|
||||
config.on_attach = util.add_hook_after(config.on_attach, opts.on_attach)
|
||||
else
|
||||
config.on_attach = opts.on_attach
|
||||
end
|
||||
config.capabilities = opts.capabilities
|
||||
end)
|
||||
|
||||
lsp_installer.setup({
|
||||
ui = {
|
||||
icons = {
|
||||
server_installed = "✓",
|
||||
@@ -69,14 +29,65 @@ lsp_installer.settings({
|
||||
}
|
||||
})
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {
|
||||
on_attach = require("lsp.handlers").on_attach,
|
||||
capabilities = require("lsp.handlers").capabilities,
|
||||
lspconfig.omnisharp.setup({
|
||||
handlers = {
|
||||
["textDocument/definition"] = require('omnisharp_extended').handler,
|
||||
},
|
||||
cmd_env = {
|
||||
["OMNISHARP_FormattingOptions:EnableEditorConfigSupport"] = true,
|
||||
["OMNISHARP_RoslynExtensionsOptions:enableAnalyzersSupport"] = true,
|
||||
["OMNISHARP_RoslynExtensionsOptions:enableImportCompletion"] = true,
|
||||
["OMNISHARP_RoslynExtensionsOptions:enableDecompilationSupport"] = true,
|
||||
["OMNISHARP_msbuild:EnablePackageAutoRestore"] = true,
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig.jsonls.setup({
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require('schemastore').json.schemas(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
lspconfig.sumneko_lua.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig.robotframework_ls.setup({
|
||||
settings = {
|
||||
robot = {
|
||||
codeFormatter = "robotidy",
|
||||
variables = {
|
||||
RESOURCES = vim.fn.getcwd() .. "/tests/robot/",
|
||||
},
|
||||
},
|
||||
}
|
||||
opts = vim.tbl_deep_extend("force", server:get_default_options(), opts)
|
||||
if server_settings[server.name] then
|
||||
opts = vim.tbl_deep_extend("force", server_settings[server.name], opts)
|
||||
end
|
||||
server:setup(opts)
|
||||
end)
|
||||
})
|
||||
|
||||
lspconfig.ltex.setup({
|
||||
settings = {
|
||||
ltex = {
|
||||
dictionary = {
|
||||
en = { ":~/.cache/nvim/ltex.dictionary.en-us.txt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
for _, server in ipairs(lsp_installer.get_installed_servers()) do
|
||||
lspconfig[server.name].setup({})
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user