1+ --- @type integer
12local lsp_group = vim .api .nvim_create_augroup (' UserLspConfig' , { clear = true })
23
34-- Highlight references to the symbol under the cursor.
45vim .api .nvim_create_autocmd (' LspAttach' , {
56 group = lsp_group ,
7+ --- @param args { buf : integer , data : { client_id : integer } }
68 callback = function (args )
79 local client = vim .lsp .get_client_by_id (args .data .client_id )
810 if not client then
@@ -15,6 +17,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
1517 args .buf
1618 )
1719 then
20+ --- @type integer
1821 local highlight_group =
1922 vim .api .nvim_create_augroup (' LspDocumentHighlight' , { clear = false })
2023
@@ -39,14 +42,18 @@ vim.api.nvim_create_autocmd('LspAttach', {
3942-- General keymaps for LSP functions.
4043vim .api .nvim_create_autocmd (' LspAttach' , {
4144 group = lsp_group ,
45+ --- @param args { buf : integer }
4246 callback = function (args )
47+ --- @type { buffer : integer , silent : boolean }
4348 local map_opts = { buffer = args .buf , silent = true }
4449
4550 vim .keymap .set (' n' , ' gd' , vim .lsp .buf .definition , map_opts )
4651 vim .keymap .set (' n' , ' gD' , vim .lsp .buf .declaration , map_opts )
4752 vim .keymap .set (' n' , ' J' , vim .diagnostic .open_float , map_opts )
4853 vim .keymap .set (' n' , ' K' , function ()
54+ --- @type integer
4955 local width = math.floor (vim .o .columns * 0.8 )
56+ --- @type integer
5057 local height = math.floor (vim .o .lines * 0.3 )
5158 vim .lsp .buf .hover ({ max_height = height , max_width = width })
5259 end , map_opts )
@@ -56,6 +63,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
5663-- Keymaps for inlay hints.
5764vim .api .nvim_create_autocmd (' LspAttach' , {
5865 group = lsp_group ,
66+ --- @param args { buf : integer , data : { client_id : integer } }
5967 callback = function (args )
6068 local client = vim .lsp .get_client_by_id (args .data .client_id )
6169 if not client then
0 commit comments