@@ -308,71 +308,72 @@ end
308308local handlers = {
309309 [" code_actions" ] = {
310310 label = " Code Actions" ,
311- server_capability = " codeActionProvider" ,
312311 method = " textDocument/codeAction" ,
313312 },
314313 [" references" ] = {
315314 label = " References" ,
316- server_capability = " referencesProvider" ,
317315 method = " textDocument/references" ,
318316 handler = location_handler
319317 },
320318 [" definitions" ] = {
321319 label = " Definitions" ,
322- server_capability = " definitionProvider" ,
323320 method = " textDocument/definition" ,
324321 handler = location_handler
325322 },
326323 [" declarations" ] = {
327324 label = " Declarations" ,
328- server_capability = " declarationProvider" ,
329325 method = " textDocument/declaration" ,
330326 handler = location_handler
331327 },
332328 [" typedefs" ] = {
333329 label = " Type Definitions" ,
334- server_capability = " typeDefinitionProvider" ,
335330 method = " textDocument/typeDefinition" ,
336331 handler = location_handler
337332 },
338333 [" implementations" ] = {
339334 label = " Implementations" ,
340- server_capability = " implementationProvider" ,
341335 method = " textDocument/implementation" ,
342336 handler = location_handler
343337 },
344338 [" document_symbols" ] = {
345339 label = " Document Symbols" ,
346- server_capability = " documentSymbolProvider" ,
347340 method = " textDocument/documentSymbol" ,
348341 handler = symbol_handler
349342 },
350343 [" workspace_symbols" ] = {
351344 label = " Workspace Symbols" ,
352- server_capability = " workspaceSymbolProvider" ,
353345 method = " workspace/symbol" ,
354346 handler = symbol_handler
355347 },
356348 [" live_workspace_symbols" ] = {
357349 label = " Workspace Symbols" ,
358- server_capability = " workspaceSymbolProvider" ,
359350 method = " workspace/symbol" ,
360351 handler = symbol_handler
361352 },
362353 [" incoming_calls" ] = {
363354 label = " Incoming Calls" ,
364- server_capability = " callHierarchyProvider" ,
365355 method = " callHierarchy/incomingCalls" ,
366356 prep = " textDocument/prepareCallHierarchy" ,
367357 handler = call_hierarchy_handler
368358 },
369359 [" outgoing_calls" ] = {
370360 label = " Outgoing Calls" ,
371- server_capability = " callHierarchyProvider" ,
372361 method = " callHierarchy/outgoingCalls" ,
373362 prep = " textDocument/prepareCallHierarchy" ,
374363 handler = call_hierarchy_handler
375364 },
365+ [" type_sub" ] = {
366+ label = " TypeHierarchy Sub" ,
367+ method = " typeHierarchy/subtypes" ,
368+ prep = " textDocument/prepareTypeHierarchy" ,
369+ handler = location_handler
370+ },
371+ [" type_super" ] = {
372+ label = " TypeHierarchy Super" ,
373+ method = " typeHierarchy/supertypes" ,
374+ prep = " textDocument/prepareTypeHierarchy" ,
375+ handler = location_handler
376+ },
376377}
377378
378379local function gen_lsp_contents (opts )
@@ -577,7 +578,7 @@ local function gen_lsp_contents(opts)
577578end
578579
579580-- see $VIMRUNTIME/lua/vim/buf.lua:pick_call_hierarchy_item()
580- local function gen_lsp_contents_call_hierarchy (opts )
581+ local function gen_lsp_contents_hierarchy (opts )
581582 local timeout = 5000
582583 if type (opts .async_or_timeout ) == " number" then
583584 timeout = opts .async_or_timeout
@@ -663,11 +664,19 @@ M.implementations = function(opts)
663664end
664665
665666M .incoming_calls = function (opts )
666- return fzf_lsp_locations (opts , gen_lsp_contents_call_hierarchy )
667+ return fzf_lsp_locations (opts , gen_lsp_contents_hierarchy )
667668end
668669
669670M .outgoing_calls = function (opts )
670- return fzf_lsp_locations (opts , gen_lsp_contents_call_hierarchy )
671+ return fzf_lsp_locations (opts , gen_lsp_contents_hierarchy )
672+ end
673+
674+ M .type_sub = function (opts )
675+ return fzf_lsp_locations (opts , gen_lsp_contents_hierarchy )
676+ end
677+
678+ M .type_super = function (opts )
679+ return fzf_lsp_locations (opts , gen_lsp_contents_hierarchy )
671680end
672681
673682M .finder = function (opts )
@@ -684,7 +693,6 @@ M.finder = function(opts)
684693 opts .silent = opts .silent == nil and true or opts .silent
685694 opts .no_autoclose = true
686695 opts .lsp_handler = handlers [method ]
687- opts .lsp_handler .capability = opts .lsp_handler .server_capability
688696 opts .lsp_params = lsp_params -- reset previous calls params if existed
689697
690698 -- returns nil for no client attached, false for unsupported capability
@@ -695,8 +703,12 @@ M.finder = function(opts)
695703 return
696704 elseif check then
697705 local _ , c = (function ()
698- if method == " incoming_calls" or method == " outgoing_calls" then
699- return gen_lsp_contents_call_hierarchy (opts )
706+ if method == " incoming_calls"
707+ or method == " outgoing_calls"
708+ or method == " type_sub"
709+ or method == " type_super"
710+ then
711+ return gen_lsp_contents_hierarchy (opts )
700712 else
701713 return gen_lsp_contents (opts )
702714 end
@@ -899,7 +911,6 @@ local function wrap_fn(key, fn)
899911 return function (opts )
900912 opts = opts or {}
901913 opts .lsp_handler = handlers [key ]
902- opts .lsp_handler .capability = opts .lsp_handler .server_capability
903914
904915 -- check_capabilities will print the appropriate warning
905916 if not check_capabilities (opts .lsp_handler , opts .silent ) then
0 commit comments