|
| 1 | +*calltree.txt* Calltree |
| 2 | +*calltree.nvim* |
| 3 | + |
| 4 | +Author: Louis DeLosSantos <louis.delos@gmail.com> |
| 5 | +Homepage: <https://github.com/ldelossa/calltree.nvim> |
| 6 | +License: MIT license |
| 7 | + |
| 8 | + ______ ________ __ __ _________ ______ ______ ______ |
| 9 | +/_____/\ /_______/\ /_/\ /_/\ /________/\/_____/\ /_____/\ /_____/\ |
| 10 | +\:::__\/ \::: _ \ \\:\ \ \:\ \ \__.::.__\/\:::_ \ \ \::::_\/_\::::_\/_ |
| 11 | + \:\ \ __\::(_) \ \\:\ \ \:\ \ \::\ \ \:(_) ) )_\:\/___/\\:\/___/\ |
| 12 | + \:\ \/_/\\:: __ \ \\:\ \____\:\ \____\::\ \ \: __ `\ \\::___\/_\::___\/_ |
| 13 | + \:\_\ \ \\:.\ \ \ \\:\/___/\\:\/___/\\::\ \ \ \ `\ \ \\:\____/\\:\____/\ |
| 14 | + \_____\/ \__\/\__\/ \_____\/ \_____\/ \__\/ \_\/ \_\/ \_____\/ \_____\/ |
| 15 | + |
| 16 | +==================================================================================== |
| 17 | +CONTENTS *calltree-contents* |
| 18 | + |
| 19 | + 1. Intro........................................|calltree-intro| |
| 20 | + 2. Usage........................................|caltree-usage| |
| 21 | + 3. Commands.....................................|calltree-commands| |
| 22 | + 3. Config.......................................|calltree-config| |
| 23 | + |
| 24 | +==================================================================================== |
| 25 | +INTRODUCTION *calltree-intro* |
| 26 | + |
| 27 | +Calltree is a simple plugin which adds the missing "call-hierarchy" tool |
| 28 | +found in IDEs such as Pycharm and VSCode. |
| 29 | + |
| 30 | +A "call-hierarchy" tool creates a tree view of incoming (callers) or outging |
| 31 | +(callees) for a given symbol. |
| 32 | + |
| 33 | +From there you can drive down further, discovering "callers-of-callers" or |
| 34 | +"callees-of-callees", and producing a tree view. |
| 35 | + |
| 36 | +==================================================================================== |
| 37 | +Usage *calltree-usage* |
| 38 | + |
| 39 | +Calltree's entry point is the "calltree.lsp.handlers.ch_lsp_handler" function. |
| 40 | + |
| 41 | +This function returns a handler suitable for usage in neovim's LSP handler |
| 42 | +dicationary. |
| 43 | + |
| 44 | +While the setup function will hijack the handlers dict for you, you can also do this |
| 45 | +manually like so: |
| 46 | + |
| 47 | + vim.lsp.handlers['callHierarchy/incomingCalls'] = vim.lsp.with( |
| 48 | + require('calltree.lsp.handlers').ch_lsp_handler("from"), {} |
| 49 | + ) |
| 50 | + vim.lsp.handlers['callHierarchy/outgoingCalls'] = vim.lsp.with( |
| 51 | + require('calltree.lsp.handlers').ch_lsp_handler("to"), {} |
| 52 | + ) |
| 53 | + |
| 54 | +This is what the "callsigns.setup()" function does. |
| 55 | + |
| 56 | +Once the calltree handlers are in place issuing the normal "vim.lsp.buf.incoming_calls" |
| 57 | +and "vim.lsp.buf.outgoing_calls" will open the calltree window. |
| 58 | + |
| 59 | +From there check out *calltree-commands* to manipulate the calltree UI. |
| 60 | + |
| 61 | +==================================================================================== |
| 62 | +COMMANDS *calltree-commands* |
| 63 | + |
| 64 | +Calltree exports several commands for manipulating the calltree UI. |
| 65 | + |
| 66 | + *:CTOpen* |
| 67 | +:CTOpen |
| 68 | + Open the calltree window with the most recent call tree present. |
| 69 | + |
| 70 | + *:CTClose* |
| 71 | +:CTClose |
| 72 | + Closes the calltree window |
| 73 | + |
| 74 | + |
| 75 | + *:CTExpand* |
| 76 | +:CTExpand |
| 77 | + Expands a calltree symbol resolving any callers/callees of the symbol under |
| 78 | + the cursor. |
| 79 | + |
| 80 | + *:CTCollapse* |
| 81 | +:CTCollapse |
| 82 | + Collapses a calltree symbol and its subtree. |
| 83 | + |
| 84 | + *:CTFocus* |
| 85 | +:CTFocus |
| 86 | + Create a new calltree with the symbol under the cursor as root. |
| 87 | + |
| 88 | + *:CTJump* |
| 89 | +:CTJump |
| 90 | + Jump to the symbol's definition. |
| 91 | + How this jump is done is controlled via config. |
| 92 | + |
| 93 | + *:CTHover* |
| 94 | +:CTHover |
| 95 | + Show hover info for the symbol |
| 96 | + |
| 97 | + *:CTDumpTree* |
| 98 | +:CTDumpTree |
| 99 | + Echos the current calltree in lua dictonary syntax. |
| 100 | + Useful for debugging. |
| 101 | + |
| 102 | +==================================================================================== |
| 103 | +CONFIG *calltree-config* |
| 104 | + |
| 105 | +To configure calltree you can pass the a config table to "require('calltree').setup(config)". |
| 106 | +You only need to specify the fields you wish to override. |
| 107 | + |
| 108 | +The config table is described below: |
| 109 | + |
| 110 | + M.config = { |
| 111 | + -- where the calltree ui will spawn |
| 112 | + -- "left" (default) - Spawn calltree as the left most vertical window. |
| 113 | + -- "right" - Spawn calltree as the left most vertical window. |
| 114 | + layout = "left", |
| 115 | + -- the initial size of the calltree ui |
| 116 | + -- int - An integer used in the initial "resize" command for |
| 117 | + -- the ui. |
| 118 | + layout_size = 30, |
| 119 | + -- the method used when jumping to a symbol in the calltree |
| 120 | + -- "invoking" - Jumping to a symbol will use the window which the calltree |
| 121 | + -- was initially invoked from. |
| 122 | + -- If the invoking window has been removed a new botright split |
| 123 | + -- will be created and take on the invoking window identity from there. |
| 124 | + -- "neighbor" - Jumping to a symbol will use the neighbor on the opposite side of |
| 125 | + -- the call tree. |
| 126 | + -- If no neighbor exists a split will be created for the jump. |
| 127 | + jump_mode = "invoking", |
| 128 | + -- the icon to represent the symbol type |
| 129 | + -- "none" - No icons for symbol types will just use text |
| 130 | + -- "nerd" - Use Nerd font icon set for symbol types (requires patched font) |
| 131 | + -- "codicon" - Use VSCode codicon icon set for symbol types (requires patched font) |
| 132 | + icons = "none" |
| 133 | + } |
| 134 | + |
| 135 | + |
| 136 | + |
0 commit comments