mirror of
https://github.com/zoriya/dotfiles.git
synced 2026-06-04 03:26:38 +00:00
Update lsp setup
This commit is contained in:
@@ -21,3 +21,5 @@ alias "o"="l"
|
|||||||
alias "k"="l"
|
alias "k"="l"
|
||||||
|
|
||||||
alias ls="exa --group"
|
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")
|
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
|
||||||
if not status_ok then
|
if not status_ok or not ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local server_settings = {
|
local util = require "lspconfig.util"
|
||||||
omnisharp = {
|
util.on_setup = util.add_hook_after(util.on_setup, function(config)
|
||||||
handlers = {
|
local opts = {
|
||||||
["textDocument/definition"] = require('omnisharp_extended').handler,
|
on_attach = require("lsp.handlers").on_attach,
|
||||||
},
|
capabilities = require("lsp.handlers").capabilities,
|
||||||
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" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = {
|
ui = {
|
||||||
icons = {
|
icons = {
|
||||||
server_installed = "✓",
|
server_installed = "✓",
|
||||||
@@ -69,14 +29,65 @@ lsp_installer.settings({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
lsp_installer.on_server_ready(function(server)
|
lspconfig.omnisharp.setup({
|
||||||
local opts = {
|
handlers = {
|
||||||
on_attach = require("lsp.handlers").on_attach,
|
["textDocument/definition"] = require('omnisharp_extended').handler,
|
||||||
capabilities = require("lsp.handlers").capabilities,
|
},
|
||||||
|
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)
|
lspconfig.ltex.setup({
|
||||||
end
|
settings = {
|
||||||
server:setup(opts)
|
ltex = {
|
||||||
end)
|
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