Nvim: update most of the plugins
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
return {
|
||||
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
"SmiteshP/nvim-navbuddy",
|
||||
-- "SmiteshP/nvim-navbuddy",
|
||||
{url = "http://git.sr.ht/~p00f/clangd_extensions.nvim"},
|
||||
"jubnzv/virtual-types.nvim",
|
||||
"ray-x/lsp_signature.nvim",
|
||||
--"ray-x/lsp_signature.nvim",
|
||||
"folke/neodev.nvim"
|
||||
},
|
||||
config = function()
|
||||
@@ -93,118 +94,84 @@ return {
|
||||
}
|
||||
}
|
||||
})
|
||||
local lsp_signature = require('lsp_signature')
|
||||
--local lsp_signature = require('lsp_signature')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<leader>E', '<cmd>lua vim.diagnostic.set_loclist()<CR>', opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>q", "<cmd>lua vim.lsp.buf.format{ async = true }<CR>", opts)
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>E', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
--Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
---- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
--vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
--vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
--vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
--vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<F6>', '<cmd>ClangdSwitchSourceHeader<cr>', opts)
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
--vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
--vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
--vim.keymap.set('n', '<space>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||
--vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<F6>', '<cmd>ClangdSwitchSourceHeader<CR>', opts)
|
||||
vim.keymap.set("n", "<leader>q", function() vim.lsp.buf.format{ async = true } end, opts)
|
||||
|
||||
-- require'illuminate'.on_attach(client)
|
||||
require'virtualtypes'.on_attach()
|
||||
require'lsp_signature'.on_attach({
|
||||
floating_window = true,
|
||||
floating_window_above_cur_line = false,
|
||||
floating_window_off_x = 500,
|
||||
floating_window_off_y = -5,
|
||||
})
|
||||
require'nvim-navbuddy'.attach(client, bufnr)
|
||||
require'nvim-navic'.attach(client, bufnr)
|
||||
require("clangd_extensions.inlay_hints").setup_autocmd()
|
||||
require("clangd_extensions.inlay_hints").set_inlay_hints()
|
||||
end
|
||||
require'virtualtypes'.on_attach()
|
||||
-- require'lsp_signature'.on_attach({
|
||||
-- floating_window = true,
|
||||
-- floating_window_above_cur_line = true,
|
||||
-- floating_window_off_x = 10,
|
||||
-- floating_window_off_y = 0,
|
||||
-- })
|
||||
require("clangd_extensions.inlay_hints").setup_autocmd()
|
||||
require("clangd_extensions.inlay_hints").set_inlay_hints()
|
||||
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = "" },
|
||||
{ name = "DiagnosticSignWarn", text = "" },
|
||||
{ name = "DiagnosticSignHint", text = "" },
|
||||
{ name = "DiagnosticSignInfo", text = "" },
|
||||
}
|
||||
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
signs = {
|
||||
active = signs,
|
||||
--severity_limit = 'info',
|
||||
},
|
||||
severity_sort = true,
|
||||
underline = false,
|
||||
update_in_insert = false,
|
||||
--virtual_text = {
|
||||
-- spacing = 40,
|
||||
-- severity_limit = 'Warning',
|
||||
--},
|
||||
virtual_text = false,
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = "" },
|
||||
{ name = "DiagnosticSignWarn", text = "" },
|
||||
{ name = "DiagnosticSignHint", text = "" },
|
||||
{ name = "DiagnosticSignInfo", text = "" },
|
||||
}
|
||||
)
|
||||
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
signs = false,
|
||||
severity_sort = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 30,
|
||||
},
|
||||
float = true
|
||||
}
|
||||
)
|
||||
end
|
||||
})
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
capabilities.offsetEncoding = { "utf-16" }
|
||||
|
||||
nvim_lsp.groovyls.setup({
|
||||
cmd = { "java", "-jar", "/home/kmcr/tools/groovy-language-server/build/libs/groovy-language-server-all.jar" },
|
||||
on_attach = on_attach,
|
||||
--on_publish_diagnostics = diagnostic_handler,
|
||||
capabilities = capabilities
|
||||
})
|
||||
|
||||
-- nvim_lsp.ccls.setup(
|
||||
-- coq.lsp_ensure_capabilities({
|
||||
-- init_options = {
|
||||
-- compilationDatabaseDirectory = ".";
|
||||
-- index = {
|
||||
-- threads = 0;
|
||||
-- },
|
||||
-- clang = {
|
||||
-- excludeArgs = { "-frounding-math"} ;
|
||||
-- },
|
||||
-- },
|
||||
-- root_dir = nvim_lsp.util.root_pattern("compile_commands.json"),
|
||||
-- on_attach = on_attach,
|
||||
-- on_publish_diagnostics = diagnostic_handler,
|
||||
-- flags = {
|
||||
-- debounce_text_changes = 150,
|
||||
-- }}
|
||||
-- )
|
||||
-- )
|
||||
|
||||
nvim_lsp.clangd.setup({
|
||||
settings = {
|
||||
},
|
||||
on_attach = on_attach,
|
||||
--on_publish_diagnostics = diagnostic_handler,
|
||||
capabilities = capabilities,
|
||||
-- flags = {
|
||||
-- debounce_text_changes = 150,
|
||||
-- }
|
||||
})
|
||||
|
||||
nvim_lsp.pylsp.setup({
|
||||
@@ -216,12 +183,7 @@ return {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- flags = {
|
||||
-- debounce_text_changes = 150,
|
||||
-- },
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
--on_publish_diagnostics = diagnostic_handler,
|
||||
})
|
||||
|
||||
nvim_lsp.lua_ls.setup({
|
||||
@@ -237,23 +199,29 @@ return {
|
||||
nvim_lsp.matlab_ls.setup({
|
||||
cmd = { "matlab-language-server", "--stdio"},
|
||||
filetypes = { "matlab" },
|
||||
handlers = { [ "workspace/configuration"] = function(_, _, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
return {client.config.settings.matlab}
|
||||
end
|
||||
},
|
||||
-- handlers = { [ "workspace/configuration"] = function(_, _, ctx)
|
||||
-- local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
-- return {client.config.settings.matlab}
|
||||
-- end
|
||||
-- },
|
||||
root_dir = nvim_lsp.util.find_git_ancestor,
|
||||
single_file_support = false,
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
matlab = {
|
||||
indexWorkspace = true,
|
||||
indexWorkspace = false,
|
||||
installPath = "/usr/local/MATLAB/R2022b",
|
||||
matlabConnectionTiming = "onStart",
|
||||
telemetry = true,
|
||||
},
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
})
|
||||
|
||||
nvim_lsp.typos_lsp.setup({
|
||||
cmd = { 'typos-lsp' },
|
||||
filetypes = { '*' },
|
||||
root_dir = nvim_lsp.util.root_pattern('typos.toml', '_typos.toml', '.typos.toml'),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
})
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
@@ -261,12 +229,7 @@ return {
|
||||
local servers = { "cmake", "rust_analyzer", "bashls", "marksman" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup({
|
||||
on_attach = on_attach,
|
||||
--on_publish_diagnostics = diagnostic_handler,
|
||||
capabilities = capabilities,
|
||||
-- flags = {
|
||||
-- debounce_text_changes = 150,
|
||||
-- }
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user