2024-06-13 00:12:38 +02:00
|
|
|
require('vim.lsp.log').set_format_func(vim.inspect)
|
|
|
|
-- vim.lsp.set_log_level("debug")
|
2024-05-23 08:33:22 +02:00
|
|
|
|
|
|
|
require("config.lsp.pyright")
|
2025-01-13 14:06:38 +01:00
|
|
|
require("config.lsp.ruff")
|
2024-05-23 08:33:22 +02:00
|
|
|
-- require("config.lsp.pylsp")
|
|
|
|
-- require("config.lsp.typescript")
|
|
|
|
require("config.lsp.clangd")
|
|
|
|
require("config.lsp.vls")
|
2024-12-29 23:45:13 +01:00
|
|
|
require("config.lsp.rust_analyzer")
|
2024-05-23 08:33:22 +02:00
|
|
|
|
|
|
|
local api = vim.api
|
2025-04-24 10:57:08 +02:00
|
|
|
local opts = { noremap = true, silent = true }
|
2024-05-23 08:33:22 +02:00
|
|
|
local keymap = vim.keymap.set
|
|
|
|
|
2025-04-24 10:57:08 +02:00
|
|
|
keymap("n", "[d", "<cmd>lua vim.diagnostic.jump({count = -1, float = true})<CR>", opts)
|
|
|
|
keymap("n", "]d", "<cmd>lua vim.diagnostic.jump({count = 1, float = true})<CR>", opts)
|
|
|
|
keymap("n", "[e", "<cmd>lua vim.diagnostic.jump({count = -1, severity = vim.diagnostic.severity.ERROR, float = true})<CR>", opts)
|
|
|
|
keymap("n", "]e", "<cmd>lua vim.diagnostic.jump({count = -1, severity = vim.diagnostic.severity.ERROR, float = true})<CR>", opts)
|
|
|
|
|
|
|
|
keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
|
|
|
keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
|
|
|
keymap("n", "gh", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
|
|
|
keymap("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
|
|
|
keymap("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
|
|
|
|
|
|
|
keymap("n", "ca", "<cmd>lua require('fzf-lua').lsp_code_actions()<CR>", opts)
|
|
|
|
|
|
|
|
keymap("n", "gl", "<cmd>lua vim.diagnostic.reset()<CR>", opts)
|
|
|
|
|
|
|
|
-- Automatic completion triggering
|
|
|
|
-- vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
-- callback = function(ev)
|
|
|
|
-- local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
|
|
|
-- if client:supports_method('textDocument/completion') then
|
|
|
|
-- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
|
|
|
-- end
|
|
|
|
-- end,
|
|
|
|
-- })
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
callback = function(ev)
|
|
|
|
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
|
|
|
if client:supports_method('textDocument/completion') then
|
|
|
|
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = false })
|
2024-05-23 08:33:22 +02:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
2025-04-24 10:57:08 +02:00
|
|
|
|
|
|
|
-- Old on-attach
|
|
|
|
-- vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
-- callback = function(ev)
|
|
|
|
-- local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
|
|
|
--
|
|
|
|
-- if client.server_capabilities.completionProvider then
|
|
|
|
-- vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
|
|
|
-- vim.bo[ev.buf].completefunc = "v:lua.vim.lsp.omnifunc"
|
|
|
|
-- end
|
|
|
|
--
|
|
|
|
-- if client.server_capabilities.definitionProvider then
|
|
|
|
-- vim.bo[ev.buf].tagfunc = "v:lua.vim.lsp.tagfunc"
|
|
|
|
-- end
|
|
|
|
--
|
|
|
|
-- if client.server_capabilities.documentFormattingProvider then
|
|
|
|
-- vim.bo[ev.buf].formatexpr = "v:lua.vim.lsp.formatexpr()"
|
|
|
|
-- end
|
|
|
|
-- end,
|
|
|
|
-- })
|