@@ -121,26 +121,13 @@ return {
121121 -- Toggle to show/hide diagnostic messages
122122 map (' <leader>td' , function () vim .diagnostic .enable (not vim .diagnostic .is_enabled ()) end , ' [T]oggle [D]iagnostics' )
123123
124- -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
125- --- @param client vim.lsp.Client
126- --- @param method vim.lsp.protocol.Method
127- --- @param bufnr ? integer some lsp support methods only in specific files
128- --- @return boolean
129- local function client_supports_method (client , method , bufnr )
130- if vim .fn .has ' nvim-0.11' == 1 then
131- return client :supports_method (method , bufnr )
132- else
133- return client .supports_method (method , { bufnr = bufnr })
134- end
135- end
136-
137124 -- The following two autocommands are used to highlight references of the
138125 -- word under your cursor when your cursor rests there for a little while.
139126 -- See `:help CursorHold` for information about when this is executed
140127 --
141128 -- When you move your cursor, the highlights will be cleared (the second autocommand).
142129 local client = vim .lsp .get_client_by_id (event .data .client_id )
143- if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_documentHighlight , event .buf ) then
130+ if client and client : supports_method ( vim .lsp .protocol .Methods .textDocument_documentHighlight , event .buf ) then
144131 local highlight_augroup = vim .api .nvim_create_augroup (' kickstart-lsp-highlight' , { clear = false })
145132 vim .api .nvim_create_autocmd ({ ' CursorHold' , ' CursorHoldI' }, {
146133 buffer = event .buf ,
@@ -167,7 +154,7 @@ return {
167154 -- code, if the language server you are using supports them
168155 --
169156 -- This may be unwanted, since they displace some of your code
170- if client and client_supports_method ( client , vim .lsp .protocol .Methods .textDocument_inlayHint , event .buf ) then
157+ if client and client : supports_method ( vim .lsp .protocol .Methods .textDocument_inlayHint , event .buf ) then
171158 map (' <leader>th' , function () vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf }) end , ' [T]oggle Inlay [H]ints' )
172159 end
173160 end ,
0 commit comments