Update
This commit is contained in:
parent
a785f25b83
commit
843582f1c8
4 changed files with 114 additions and 64 deletions
|
|
@ -31,7 +31,10 @@ local options = {
|
|||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
-- { name = 'nvim_lsp_signature_help' },
|
||||
{ name = "nvim_lsp_document_symbol" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,58 +1,51 @@
|
|||
require("mason-lspconfig").setup_handlers {
|
||||
-- The first entry (without a key) will be the default handler
|
||||
-- and will be called for each installed server that doesn't have
|
||||
-- a dedicated handler.
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup {}
|
||||
end,
|
||||
-- Next, you can provide a dedicated handler for specific servers.
|
||||
-- For example, a handler override for the `rust_analyzer`:
|
||||
-- ["rust_analyzer"] = function ()
|
||||
-- require("rust-tools").setup {}
|
||||
-- end
|
||||
["lua_ls"] = function()
|
||||
require("lspconfig").lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||
[vim.fn.stdpath "data" .. "/lazy/extensions/nvchad_types"] = true,
|
||||
[vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
|
||||
},
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 10000,
|
||||
},
|
||||
},
|
||||
local default = {
|
||||
on_attach = function(client, bufnr)
|
||||
require "lsp_signature".on_attach(
|
||||
{
|
||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||
handler_opts = {
|
||||
border = "none"
|
||||
},
|
||||
hint_enable = false,
|
||||
doc_lines = 0,
|
||||
floating_window_off_x = 999,
|
||||
floating_window_off_y = 1,
|
||||
-- floating_window = false,
|
||||
}
|
||||
, bufnr) -- Note: add in lsp client on-attach
|
||||
end,
|
||||
|
||||
["ltex"] = function()
|
||||
require("lspconfig").ltex.setup {
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "fr",
|
||||
checkFrequency = "save"
|
||||
},
|
||||
-- set formatter
|
||||
formatters = {
|
||||
["latexindent"] = {
|
||||
exe = "latexindent",
|
||||
args = { "-sl", "-g /dev/stderr" },
|
||||
stdin = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
end
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
}
|
||||
|
||||
local servers = {
|
||||
java_language_server = { cmd = {"java-language-server"} },
|
||||
ocamllsp = {},
|
||||
-- "pyright",
|
||||
lua_ls = {},
|
||||
clangd = {},
|
||||
jedi_language_server = {},
|
||||
nil_ls = {},
|
||||
ltex = {
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "fr",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
for server, config in pairs(servers) do
|
||||
local lsp = require("lspconfig")[server]
|
||||
|
||||
-- print(server)
|
||||
local config = vim.tbl_deep_extend("keep", config, default, lsp.document_config.default_config)
|
||||
if config.cmd ~= nil then
|
||||
if vim.fn.executable(config.cmd[1]) == 1 then
|
||||
lsp.setup(config)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
-- signs = true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue