Python-Litee calltree.nvim: Neovim's missing call hierarchy UI

██╗     ██╗████████╗███████╗███████╗   ███╗   ██╗██╗   ██╗██╗███╗   ███╗
██║     ██║╚══██╔══╝██╔════╝██╔════╝   ████╗  ██║██║   ██║██║████╗ ████║ Lightweight
██║     ██║   ██║   █████╗  █████╗     ██╔██╗ ██║██║   ██║██║██╔████╔██║ Integrated
██║     ██║   ██║   ██╔══╝  ██╔══╝     ██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║ Text
███████╗██║   ██║   ███████╗███████╗██╗██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║ Editing
╚══════╝╚═╝   ╚═╝   ╚══════╝╚══════╝╚═╝╚═╝  ╚═══╝  ╚═══╝  ╚═╝╚═╝     ╚═╝ Environment
====================================================================================

litee screenshot

litee-calltree

litee-calltree utilizes the litee.nvim library to implement a tool analogous to VSCode's "Call Hierarchy" tool.

This tool exposes an explorable tree of incoming or outgoing calls for a given symbol.

Unlike other Neovim plugins, the tree can be expanded and collapsed to discover "callers-of-callers" and "callees-of-callees" until you hit a leaf.

Like all litee.nvim backed plugins the UI will work with other litee.nvim plugins, keeping its appropriate place in a collapsible panel.

Usage

Get it

Plug:

 Plug 'ldelossa/litee.nvim'
 Plug 'ldelossa/litee-calltree.nvim'

Set it

Call the setup function from anywhere you configure your plugins from.

Configuration dictionary is explained in ./doc/litee.txt (:h litee-config)

-- configure the litee.nvim library 
require('litee.lib').setup({})
-- configure litee-calltree.nvim
require('litee.calltree').setup({})

Use it

litee-calltree.nvim hooks directly into the LSP infrastructure by hijacking the necessary handlers like so:

vim.lsp.handlers['callHierarchy/incomingCalls'] = vim.lsp.with(
            require('litee.lsp.handlers').ch_lsp_handler("from"), {}
)
vim.lsp.handlers['callHierarchy/outgoingCalls'] = vim.lsp.with(
            require('litee.lsp.handlers').ch_lsp_handler("to"), {}
)

This occurs when require('litee.calltree').setup() is called.

Once the handlers are in place issuing the normal "vim.lsp.buf.incoming_calls" and "vim.lsp.buf.outgoing_calls" functions will open the Calltree UI, respectively.

All of LITEE.nvim can be controlled via commands making it possible to navigate the Calltree via key bindings.

Check out the help file for full details.

Comments

  • fix doc
    fix doc

    Jan 17, 2022

    fix a little doc error.

    Reply
  • fix: reintroduce help buffer
    fix: reintroduce help buffer

    Jan 4, 2022

    help buffers were lost in the refactor shuffle.

    this commit adds them back.

    Signed-off-by: ldelossa [email protected]

    Reply
  • fix default keymap.
    fix default keymap.

    Jan 17, 2022

    fix #4

                                                                                                                                                                                                           
    Reply
  • feat,popout: this commit wires in litee.nvim popout feature
    feat,popout: this commit wires in litee.nvim popout feature

    Jan 7, 2022

    this commit wires in the new litee.nvim popout feature.

    the calltree can now be popped out from the panel to a floating window with the command "LTPopOutCalltree"

    additionally a config option "on_open" is added which takes the arguments "popout" or "panel". if set to "panel" the first request for a calltree is opened in the panel, same goes for "popout".

    Reply
  • litee-calltree depends on litee-symboltree
    litee-calltree depends on litee-symboltree

    Dec 31, 2021

    Hey cool plugin!

    There's a dependency issue with litee-symboltree because the file lua/litee/calltree/marshal.lua gets its config from require('litee.symboltree.config'), so if you don't have symboltree it will throw an error. I like the recent refactoring though!

    Reply
  • Default keymap doesn't work.
    Default keymap doesn't work.

    Jan 17, 2022

    I see the correct display with this plugin installed, but the default keymap don't work at all.

    Reply