@@ -246,13 +246,7 @@ local fancy_floating_markdown = function(contents, opts)
246
246
return bufnr , winnr
247
247
end
248
248
249
- local handler = ' textDocument/hover'
250
- M .default_handler = vim .lsp .handlers [handler ]
251
-
252
249
local function handler_function (_ , method , result )
253
- -- if M.winnr ~= nil and api.nvim_win_is_valid(M.winnr) then
254
- -- api.nvim_win_close(M.winnr, true)
255
- -- end
256
250
if vim .fn .pumvisible () == 1 then
257
251
M .focusable_float (method , function ()
258
252
if not (result and result .contents ) then
@@ -300,20 +294,11 @@ local function handler_function(_, method, result)
300
294
end
301
295
return bufnr , winnr
302
296
end )
303
- else
304
- M .default_handler (_ , method , result , _ )
305
297
end
306
298
end
307
299
308
300
M .autoOpenHoverInPopup = function ()
309
301
if vim .fn .pumvisible () ~= 1 then return end
310
- for _ , client in pairs (vim .lsp .buf_get_clients (0 )) do
311
- local default_handler = (client .config .handlers or {})[' textDocument/hover' ] or vim .lsp .handlers [' textDocument/hover' ]
312
- if default_handler ~= handler_function then
313
- if not client .config .handlers then client .config .handlers = {} end
314
- client .config .handlers [' textDocument/hover' ] = handler_function
315
- end
316
- end
317
302
318
303
local bufnr = api .nvim_get_current_buf ()
319
304
if api .nvim_call_function (' pumvisible' , {}) == 1 then
@@ -372,7 +357,7 @@ M.autoOpenHoverInPopup = function()
372
357
textDocument = vim .lsp .util .make_text_document_params ();
373
358
position = { line = row ; character = col - string.len (item .word ); }
374
359
}
375
- vim .lsp .buf_request (bufnr , ' textDocument/hover' , params )
360
+ vim .lsp .buf_request (bufnr , ' textDocument/hover' , params , handler_function )
376
361
end
377
362
manager .textHover = false
378
363
end
0 commit comments