@@ -432,9 +432,11 @@ require('lazy').setup({
432432 -- Document existing key chains
433433 spec = {
434434 { ' <leader>Q' , group = ' [Q]uit' }, -- Added Q first so it appears at top
435+ { ' <leader>c' , group = ' [c]ode' }, -- Code actions, LSP commands
435436 { ' <leader>s' , group = ' [s]earch' }, -- Search commands
436437 { ' <leader>S' , group = ' [S]ession' }, -- Session management (capital S)
437438 { ' <leader>t' , group = ' [T]oggle' },
439+ { ' <leader>x' , group = ' diagnostics/quickfi[x]' }, -- Trouble/diagnostics (Telescope has <leader>sd)
438440 { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n' , ' v' } },
439441 },
440442 },
@@ -613,6 +615,26 @@ require('lazy').setup({
613615 -- If you're wondering about lsp vs treesitter, you can check out the wonderfully
614616 -- and elegantly composed help section, `:help lsp-vs-treesitter`
615617
618+ -- ========================================================================
619+ -- LSP UI Enhancements - Better hover, signature help, and borders
620+ -- ========================================================================
621+ -- Customize LSP handlers for better visual appearance (LazyVim-style)
622+
623+ -- Rounded borders for hover windows
624+ vim .lsp .handlers [' textDocument/hover' ] = vim .lsp .with (vim .lsp .handlers .hover , {
625+ border = ' rounded' ,
626+ max_width = 80 ,
627+ })
628+
629+ -- Rounded borders for signature help
630+ vim .lsp .handlers [' textDocument/signatureHelp' ] = vim .lsp .with (vim .lsp .handlers .signature_help , {
631+ border = ' rounded' ,
632+ max_width = 80 ,
633+ })
634+
635+ -- NOTE: Diagnostic config is set later in the file (around line 760)
636+ -- with comprehensive settings including virtual_text, signs, etc.
637+
616638 -- This function gets run when an LSP attaches to a particular buffer.
617639 -- That is to say, every time a new file is opened that is associated with
618640 -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
@@ -726,33 +748,50 @@ require('lazy').setup({
726748 end ,
727749 })
728750
729- -- Diagnostic Config
751+ -- Diagnostic Config - Enhanced for better visibility (LazyVim-style)
730752 -- See :help vim.diagnostic.Opts
731753 vim .diagnostic .config {
754+ -- Sort diagnostics by severity (errors first)
732755 severity_sort = true ,
733- float = { border = ' rounded' , source = ' if_many' },
734- underline = { severity = vim .diagnostic .severity .ERROR },
735- signs = vim .g .have_nerd_font and {
756+
757+ -- Underline errors and warnings
758+ underline = {
759+ severity = { min = vim .diagnostic .severity .WARN },
760+ },
761+
762+ -- Show signs in the gutter
763+ signs = {
736764 text = {
737- [vim .diagnostic .severity .ERROR ] = ' ' ,
738- [vim .diagnostic .severity .WARN ] = ' ' ,
739- [vim .diagnostic .severity .INFO ] = ' ' ,
740- [vim .diagnostic .severity .HINT ] = ' ' ,
765+ [vim .diagnostic .severity .ERROR ] = ' ' ,
766+ [vim .diagnostic .severity .WARN ] = ' ' ,
767+ [vim .diagnostic .severity .INFO ] = ' ' ,
768+ [vim .diagnostic .severity .HINT ] = ' ' ,
741769 },
742- } or {},
770+ },
771+
772+ -- Virtual text configuration (inline error messages at end of line)
773+ -- This shows the actual diagnostic message text to the right of each line
743774 virtual_text = {
744- source = ' if_many' ,
745- spacing = 2 ,
775+ spacing = 4 ,
776+ source = ' if_many' , -- Show source if multiple sources
777+ prefix = ' ■' , -- Prefix before the message
746778 format = function (diagnostic )
747- local diagnostic_message = {
748- [vim .diagnostic .severity .ERROR ] = diagnostic .message ,
749- [vim .diagnostic .severity .WARN ] = diagnostic .message ,
750- [vim .diagnostic .severity .INFO ] = diagnostic .message ,
751- [vim .diagnostic .severity .HINT ] = diagnostic .message ,
752- }
753- return diagnostic_message [diagnostic .severity ]
779+ -- Show the full diagnostic message inline
780+ return diagnostic .message
754781 end ,
755782 },
783+
784+ -- Floating window configuration (when hovering over error)
785+ float = {
786+ border = ' rounded' ,
787+ source = ' always' , -- Always show source
788+ header = ' ' ,
789+ prefix = ' ' ,
790+ focusable = true ,
791+ },
792+
793+ -- Update diagnostics in insert mode
794+ update_in_insert = false ,
756795 }
757796
758797 -- LSP servers and clients are able to communicate to each other what features they support.
@@ -1230,5 +1269,24 @@ vim.api.nvim_create_user_command('PythonRestart', function()
12301269 vim .notify (' Pyright stopped. It will restart on next edit.' , vim .log .levels .INFO )
12311270end , { desc = ' Restart Python LSP (pyright)' })
12321271
1272+ -- Ensure virtual text diagnostics are enabled after all plugins load
1273+ -- This needs to be set after plugins that might override diagnostic config
1274+ vim .api .nvim_create_autocmd (' User' , {
1275+ pattern = ' VeryLazy' ,
1276+ once = true ,
1277+ callback = function ()
1278+ vim .diagnostic .config ({
1279+ virtual_text = {
1280+ spacing = 4 ,
1281+ source = ' if_many' ,
1282+ prefix = ' ■' ,
1283+ format = function (diagnostic )
1284+ return diagnostic .message
1285+ end ,
1286+ },
1287+ })
1288+ end ,
1289+ })
1290+
12331291-- The line beneath this is called `modeline`. See `:help modeline`
12341292-- vim: ts=2 sts=2 sw=2 et
0 commit comments