diff options
| author | Cryxtalix <fgx8p9t@protonmail.com> | 2025-02-28 18:01:35 +0800 |
|---|---|---|
| committer | Cryxtalix <fgx8p9t@protonmail.com> | 2025-02-28 18:01:35 +0800 |
| commit | 0bbdf294023176d7f2689fb6386e37c22eca7e43 (patch) | |
| tree | 4fd82bd8ffe3a789e07797b449305616030bc648 /.config/nvim | |
| parent | 6be3160d680848f706c0a966a225dc98c6e093e0 (diff) | |
Made neovim lsp warnings appear in a box rather than inline
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/init.lua | 17 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 35 |
2 files changed, 45 insertions, 7 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 112ca25..a23bed7 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -27,6 +27,23 @@ vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true, silent = true }) -- end --}) +vim.diagnostic.config({ + virtual_text = false, -- Disable inline text diagnostics + signs = true, -- Keep signs in the sign column + update_in_insert = false, + underline = true, + severity_sort = true, +}) + +-- Show diagnostics on hover +vim.o.updatetime = 250 -- Faster update time for hover +vim.api.nvim_create_autocmd("CursorHold", { + pattern = "*", + callback = function() + vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" }) + end, +}) + -- Install Lazy.vim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 4e9ef07..5080622 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -12,13 +12,13 @@ return { }, { - "williamboman/mason-lspconfig.nvim", - config = function() - require("mason-lspconfig").setup { - ensure_installed = { "bashls", "lua_ls", "clangd", "marksman", "pyright", "rust_analyzer" }, - automatic_installation = true, - } - end + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup { + ensure_installed = { "bashls", "lua_ls", "clangd", "marksman", "pyright", "rust_analyzer" }, + automatic_installation = true, + } + end }, { @@ -44,6 +44,27 @@ return { }) lspconfig.rust_analyzer.setup({ capabilities = capabilities, + settings = { + ['rust-analyzer'] = { + assist = { + importEnforceGranularity = true, + importPrefix = 'crate', + }, + cargo = { + allFeatures = true, + }, + checkOnSave = { + command = 'clippy', + }, + inlayHints = { locationLinks = false }, + diagnostics = { + enable = true, + experimental = { + enable = true, + }, + }, + }, + }, }) -- Key mapping |
