feat(plugins): Add workspace-diagnostics.nvim
and trouble.nvim
Fix `nvim-navic` for some LSPs
This commit is contained in:
parent
b2f592d529
commit
9e58b1629d
11 changed files with 101 additions and 66 deletions
19
flake.lock
19
flake.lock
|
@ -216,7 +216,8 @@
|
|||
"flake-utils": "flake-utils",
|
||||
"gen-luarc": "gen-luarc",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"presence-nvim": "presence-nvim"
|
||||
"presence-nvim": "presence-nvim",
|
||||
"workspace-diagnostics-nvim": "workspace-diagnostics-nvim"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
@ -233,6 +234,22 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"workspace-diagnostics-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1723294887,
|
||||
"narHash": "sha256-lBj4KUPmmhtpffYky/HpaTwY++d/Q9socp/Ys+4VeX0=",
|
||||
"owner": "artemave",
|
||||
"repo": "workspace-diagnostics.nvim",
|
||||
"rev": "573ff93c47898967efdfbc6587a1a39e3c2d365e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "artemave",
|
||||
"repo": "workspace-diagnostics.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
url = "github:jiriks74/presence.nvim";
|
||||
flake = false;
|
||||
};
|
||||
workspace-diagnostics-nvim = {
|
||||
url = "github:artemave/workspace-diagnostics.nvim";
|
||||
flake = false;
|
||||
};
|
||||
# wf-nvim = {
|
||||
# url = "github:Cassin01/wf.nvim";
|
||||
# flake = false;
|
||||
|
|
|
@ -99,6 +99,7 @@ with final.pkgs.lib; let
|
|||
nvim-unception # Prevent nested neovim sessions | nvim-unception
|
||||
better-escape-nvim # Map keys without delay when typing | https://github.com/max397574/better-escape.nvim
|
||||
toggleterm-nvim # A neovim lua plugin to help easily manage multiple terminal windows | https://github.com/akinsho/toggleterm.nvim?tab=readme-ov-file
|
||||
trouble-nvim # A pretty diagnostics list | https://github.com/folke/trouble.nvim
|
||||
# ^ Useful utilities
|
||||
|
||||
# libraries that other plugins depend on
|
||||
|
@ -112,6 +113,7 @@ with final.pkgs.lib; let
|
|||
|
||||
# bleeding-edge plugins from flake inputs
|
||||
(mkNvimPlugin inputs.presence-nvim "presence.nvim")
|
||||
(mkNvimPlugin inputs.workspace-diagnostics-nvim "workspace-diagnostics.nvim")
|
||||
# (mkNvimPlugin inputs.wf-nvim "wf.nvim") # (example) keymap hints | https://github.com/Cassin01/wf.nvim
|
||||
# ^ bleeding-edge plugins from flake inputs
|
||||
];
|
||||
|
|
|
@ -16,5 +16,9 @@ vim.lsp.start {
|
|||
cmd = { 'asm-lsp' },
|
||||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
capabilities = require('user.lsp').make_client_capabilities(),
|
||||
on_attach = function(client, bufnr)
|
||||
require("nvim-navic").attach(client, bufnr)
|
||||
require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
|
||||
end,
|
||||
-- capabilities = { offsetEncoding = "utf-8" },
|
||||
}
|
||||
|
|
|
@ -17,8 +17,9 @@ vim.lsp.start {
|
|||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
capabilities = require('user.lsp').make_client_capabilities(),
|
||||
on_attach = function(client, bufnr)
|
||||
require("nvim-navic").attach(client, bufnr)
|
||||
end
|
||||
require("nvim-navic").attach(client, bufnr)
|
||||
require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
|
||||
end
|
||||
}
|
||||
|
||||
local dap = require("dap")
|
||||
|
@ -59,19 +60,19 @@ if vim.fn.executable('OpenDebugAD7') == 1 then
|
|||
return coroutine.create(function(coro)
|
||||
local opts = {}
|
||||
pickers
|
||||
.new(opts, {
|
||||
prompt_title = "Path to executable",
|
||||
finder = finders.new_oneshot_job({ "fd", "--hidden", "--no-ignore", "--type", "x" }, {}),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(buffer_number)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(buffer_number)
|
||||
coroutine.resume(coro, action_state.get_selected_entry()[1])
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
:find()
|
||||
.new(opts, {
|
||||
prompt_title = "Path to executable",
|
||||
finder = finders.new_oneshot_job({ "fd", "--hidden", "--no-ignore", "--type", "x" }, {}),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(buffer_number)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(buffer_number)
|
||||
coroutine.resume(coro, action_state.get_selected_entry()[1])
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
:find()
|
||||
end)
|
||||
end,
|
||||
stopAtBeginningOfMainSubprogram = true,
|
||||
|
|
|
@ -25,6 +25,10 @@ vim.lsp.start {
|
|||
cmd = { lua_ls_cmd },
|
||||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
capabilities = require('user.lsp').make_client_capabilities(),
|
||||
on_attach = function(client, bufnr)
|
||||
require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
|
||||
require("nvim-navic").attach(client, bufnr)
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
|
|
|
@ -15,4 +15,8 @@ vim.lsp.start {
|
|||
cmd = { 'nil' },
|
||||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
capabilities = require('user.lsp').make_client_capabilities(),
|
||||
on_attach = function(client, bufnr)
|
||||
require("nvim-navic").attach(client, bufnr)
|
||||
require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -15,29 +15,8 @@ vim.lsp.start {
|
|||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
-- capabilities = require('user.lsp').make_client_capabilities(),
|
||||
single_file_support = true,
|
||||
on_attach = function(client, bufnr)
|
||||
require("nvim-navic").attach(client, bufnr)
|
||||
require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
|
||||
end,
|
||||
}
|
||||
|
||||
-- local dap = require("dap")
|
||||
--
|
||||
-- if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/launch.json") then
|
||||
-- require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } })
|
||||
-- end
|
||||
--
|
||||
-- dap.adapters.gdb = {
|
||||
-- type = "executable",
|
||||
-- command = "gdb",
|
||||
-- args = { "-i", "dap" }
|
||||
-- }
|
||||
--
|
||||
-- dap.configurations.c = {
|
||||
-- {
|
||||
-- name = "Launch",
|
||||
-- type = "gdb",
|
||||
-- request = "launch",
|
||||
-- program = function()
|
||||
-- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
-- end,
|
||||
-- cwd = "${workspaceFolder}",
|
||||
-- stopAtBeginningOfMainSubprogram = false,
|
||||
-- },
|
||||
-- }
|
||||
|
|
|
@ -12,6 +12,6 @@ require("aerial").setup({
|
|||
-- end,
|
||||
})
|
||||
-- You probably also want to set a keymap to toggle aerial
|
||||
vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle!<CR>")
|
||||
vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle! right<CR>")
|
||||
|
||||
|
||||
|
|
|
@ -13,34 +13,53 @@ keymap.set('n', 'Y', 'y$', { silent = true, desc = '[Y]ank to end of line' })
|
|||
|
||||
require('which-key').add({
|
||||
-- Buffer list navigation, ordering, ...
|
||||
{ "<C-b>", "<Cmd>BufferLineTogglePin<Cr>", desc = '[p]in buffer' },
|
||||
{ "gB", "<Cmd>BufferLinePick<Cr>", desc = '[g]o to [b]uffer' },
|
||||
{ '>b', "<Cmd>BufferLineMoveNext<Cr>", desc = 'move [b]uffer right' },
|
||||
{ '<b', "<Cmd>BufferLineMovePrev<Cr>", desc = 'move [b]uffer left' },
|
||||
{ '[b', "<Cmd>BufferLineCyclePrev<Cr>", desc = 'previous [b]uffer' },
|
||||
{ ']b', "<Cmd>BufferLineCycleNext<Cr>", desc = 'next [b]uffer' },
|
||||
{ '[B', vim.cmd.bfirst, desc = 'first [B]uffer' },
|
||||
{ ']B', vim.cmd.blast, desc = 'last [B]uffer' },
|
||||
{ '<leader>tn', vim.cmd.tabnew, desc = '[t]ab: [n]ew' },
|
||||
{ '<leader>tq', "<Cmd>bd<Cr>", desc = '[t]ab: [q]uit/close' },
|
||||
{ '<leader>c', "<Cmd>bd<Cr>", desc = '[c]lose tab' },
|
||||
{ "<C-b>", "<Cmd>BufferLineTogglePin<Cr>", desc = '[p]in buffer' },
|
||||
{ "gB", "<Cmd>BufferLinePick<Cr>", desc = '[g]o to [b]uffer' },
|
||||
{ '>b', "<Cmd>BufferLineMoveNext<Cr>", desc = 'move [b]uffer right' },
|
||||
{ '<b', "<Cmd>BufferLineMovePrev<Cr>", desc = 'move [b]uffer left' },
|
||||
{ '[b', "<Cmd>BufferLineCyclePrev<Cr>", desc = 'previous [b]uffer' },
|
||||
{ ']b', "<Cmd>BufferLineCycleNext<Cr>", desc = 'next [b]uffer' },
|
||||
{ '[B', vim.cmd.bfirst, desc = 'first [B]uffer' },
|
||||
{ ']B', vim.cmd.blast, desc = 'last [B]uffer' },
|
||||
{ '<leader>tn', vim.cmd.tabnew, desc = '[t]ab: [n]ew' },
|
||||
{ '<leader>tq', "<Cmd>bd<Cr>", desc = '[t]ab: [q]uit/close' },
|
||||
{ '<leader>c', "<Cmd>bd<Cr>", desc = '[c]lose tab' },
|
||||
|
||||
-- Window resizing
|
||||
{ "<C-Up>", "<Cmd>resize -2<CR>", desc = "resize split up" },
|
||||
{ "<C-Down>", "<Cmd>resize +2<CR>", desc = "resize split down" },
|
||||
{ "<C-Left>", "<Cmd>vertical resize +2<CR>", desc = "resize split left" },
|
||||
{ "<C-Right>", "<Cmd>vertical resize -2<CR>", desc = "resize split right" },
|
||||
{ "<C-Up>", "<Cmd>resize -2<CR>", desc = "resize split up" },
|
||||
{ "<C-Down>", "<Cmd>resize +2<CR>", desc = "resize split down" },
|
||||
{ "<C-Left>", "<Cmd>vertical resize +2<CR>", desc = "resize split left" },
|
||||
{ "<C-Right>", "<Cmd>vertical resize -2<CR>", desc = "resize split right" },
|
||||
|
||||
-- ToggleTerm
|
||||
{ "<leader>Tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "[T]oggleterm [f]loat" },
|
||||
{ "<leader>Th", "<Cmd>ToggleTerm size=10 direction=horizontal<CR>", desc = "[T]oggleterm [h]orizontal split" },
|
||||
{ "<leader>Tv", "<Cmd>ToggleTerm size=80 direction=vertical<CR>", desc = "[T]oggleterm [v]ertical split" },
|
||||
{ "<F7>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" },
|
||||
{ mode = "t", "<F7>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
{ mode = "i", "<F7>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
{ "<C-'>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>
|
||||
{ "<C-'>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>
|
||||
{ "<C-'>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>`
|
||||
{ "<leader>Tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "[T]oggleterm [f]loat" },
|
||||
{ "<leader>Th", "<Cmd>ToggleTerm size=10 direction=horizontal<CR>", desc = "[T]oggleterm [h]orizontal split" },
|
||||
{ "<leader>Tv", "<Cmd>ToggleTerm size=80 direction=vertical<CR>", desc = "[T]oggleterm [v]ertical split" },
|
||||
{ "<F7>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" },
|
||||
{ mode = "t", "<F7>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
{ mode = "i", "<F7>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
{ "<C-'>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>
|
||||
{ "<C-'>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>
|
||||
{ "<C-'>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" }, -- requires terminal that supports binding <C-'>`
|
||||
|
||||
-- Trouble
|
||||
{ "<leader>x", group = "trouble" },
|
||||
{ "<leader>xt", "<cmd>Trouble diagnostics toggle<cr>", desc = "trouble: [t]oggle", },
|
||||
{ "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "trouble: [b]uffer diagnostics", },
|
||||
{ "<leader>xs", "<cmd>Trouble symbols toggle focus=false<cr>", desc = "trouble: [s]ymbols (Trouble)", },
|
||||
{ "<leader>xl", "<cmd>Trouble lsp toggle focus=false win.position=right<cr>", desc = "trouble: [l]sp definitions / references / ...", },
|
||||
{ "<leader>xL", "<cmd>Trouble loclist toggle<cr>", desc = "trouble: [L]ocation list", },
|
||||
{ "<leader>xQ", "<cmd>Trouble qflist toggle<cr>", desc = "trouble: [q]uickfix list", },
|
||||
{
|
||||
"<leader>xw",
|
||||
noremap = true,
|
||||
callback = function()
|
||||
for _, client in ipairs(vim.lsp.buf_get_clients()) do
|
||||
require("workspace-diagnostics").populate_workspace_diagnostics(client, 0)
|
||||
end
|
||||
end,
|
||||
desc = "trouble: load [w]orkspace"
|
||||
},
|
||||
})
|
||||
|
||||
-- Toggle the quickfix list (only opens if it is populated)
|
||||
|
|
|
@ -16,3 +16,4 @@ require("better_escape").setup()
|
|||
require("todo-comments").setup()
|
||||
require("bufferline").setup{}
|
||||
require("toggleterm").setup()
|
||||
require("trouble").setup()
|
||||
|
|
Loading…
Reference in a new issue