@@ -182,12 +182,22 @@ require('lazy').setup({
182182 -- with the first argument being the link and the following
183183 -- keys can be used to configure plugin behavior/loading/etc.
184184 --
185- -- Use `opts = {}` to force a plugin to be loaded.
185+ -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
186186 --
187187
188+ -- Alternatively, use `config = function() ... end` for full control over the configuration.
189+ -- If you prefer to call `setup` explicitly, use:
190+ -- {
191+ -- 'lewis6991/gitsigns.nvim',
192+ -- config = function()
193+ -- require('gitsigns').setup({
194+ -- -- Your gitsigns configuration here
195+ -- })
196+ -- end,
197+ -- }
198+ --
188199 -- Here is a more advanced example where we pass configuration
189- -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
190- -- require('gitsigns').setup({ ... })
200+ -- options to `gitsigns.nvim`.
191201 --
192202 -- See `:help gitsigns` to understand what the configuration keys do
193203 { -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -516,13 +526,26 @@ require('lazy').setup({
516526 -- For example, in C this would take you to the header.
517527 map (' gD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
518528
529+ -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
530+ --- @param client vim.lsp.Client
531+ --- @param method vim.lsp.protocol.Method
532+ --- @param bufnr ? integer some lsp support methods only in specific files
533+ --- @return boolean
534+ local function client_supports_method (client , method , bufnr )
535+ if vim .fn .has ' nvim-0.11' == 1 then
536+ return client :supports_method (method , bufnr )
537+ else
538+ return client .supports_method (method , { bufnr = bufnr })
539+ end
540+ end
541+
519542 -- The following two autocommands are used to highlight references of the
520543 -- word under your cursor when your cursor rests there for a little while.
521544 -- See `:help CursorHold` for information about when this is executed
522545 --
523546 -- When you move your cursor, the highlights will be cleared (the second autocommand).
524547 local client = vim .lsp .get_client_by_id (event .data .client_id )
525- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_documentHighlight ) then
548+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_documentHighlight , event . buf ) then
526549 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
527550 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
528551 buffer = event .buf ,
@@ -549,23 +572,42 @@ require('lazy').setup({
549572 -- code, if the language server you are using supports them
550573 --
551574 -- This may be unwanted, since they displace some of your code
552- if client and client . supports_method ( vim .lsp .protocol .Methods .textDocument_inlayHint ) then
575+ if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_inlayHint , event . buf ) then
553576 map (' <leader>th' , function ()
554577 vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf })
555578 end , ' [T]oggle Inlay [H]ints' )
556579 end
557580 end ,
558581 })
559582
560- -- Change diagnostic symbols in the sign column (gutter)
561- -- if vim.g.have_nerd_font then
562- -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
563- -- local diagnostic_signs = {}
564- -- for type, icon in pairs(signs) do
565- -- diagnostic_signs[vim.diagnostic.severity[type]] = icon
566- -- end
567- -- vim.diagnostic.config { signs = { text = diagnostic_signs } }
568- -- end
583+ -- Diagnostic Config
584+ -- See :help vim.diagnostic.Opts
585+ vim .diagnostic .config {
586+ severity_sort = true ,
587+ float = { border = ' rounded' , source = ' if_many' },
588+ underline = { severity = vim .diagnostic .severity .ERROR },
589+ signs = vim .g .have_nerd_font and {
590+ text = {
591+ [vim .diagnostic .severity .ERROR ] = ' ' ,
592+ [vim .diagnostic .severity .WARN ] = ' ' ,
593+ [vim .diagnostic .severity .INFO ] = ' ' ,
594+ [vim .diagnostic .severity .HINT ] = ' ' ,
595+ },
596+ } or {},
597+ virtual_text = {
598+ source = ' if_many' ,
599+ spacing = 2 ,
600+ format = function (diagnostic )
601+ local diagnostic_message = {
602+ [vim .diagnostic .severity .ERROR ] = diagnostic .message ,
603+ [vim .diagnostic .severity .WARN ] = diagnostic .message ,
604+ [vim .diagnostic .severity .INFO ] = diagnostic .message ,
605+ [vim .diagnostic .severity .HINT ] = diagnostic .message ,
606+ }
607+ return diagnostic_message [diagnostic .severity ]
608+ end ,
609+ },
610+ }
569611
570612 -- LSP servers and clients are able to communicate to each other what features they support.
571613 -- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -650,6 +692,8 @@ require('lazy').setup({
650692 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
651693
652694 require (' mason-lspconfig' ).setup {
695+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
696+ automatic_installation = false ,
653697 handlers = {
654698 function (server_name )
655699 local server = servers [server_name ] or {}
@@ -741,6 +785,7 @@ require('lazy').setup({
741785 -- into multiple repos for maintenance purposes.
742786 ' hrsh7th/cmp-nvim-lsp' ,
743787 ' hrsh7th/cmp-path' ,
788+ ' hrsh7th/cmp-nvim-lsp-signature-help' ,
744789 },
745790 config = function ()
746791 -- See `:help cmp`
@@ -817,6 +862,7 @@ require('lazy').setup({
817862 { name = ' nvim_lsp' },
818863 { name = ' luasnip' },
819864 { name = ' path' },
865+ { name = ' nvim_lsp_signature_help' },
820866 },
821867 }
822868 end ,
@@ -829,7 +875,8 @@ require('lazy').setup({
829875 -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
830876 ' folke/tokyonight.nvim' ,
831877 priority = 1000 , -- Make sure to load this before all the other start plugins.
832- init = function ()
878+ config = function ()
879+ --- @diagnostic disable-next-line : missing-fields
833880 require (' tokyonight' ).setup {
834881 transparent = true ,
835882 styles = {
0 commit comments