Skip to content

Commit 5d7e4e5

Browse files
committed
docs: update documentation
Signed-off-by: ldelossa <louis.delos@gmail.com>
1 parent 8b34809 commit 5d7e4e5

File tree

2 files changed

+57
-36
lines changed

2 files changed

+57
-36
lines changed

README.md

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@
1212

1313
![calltree screenshot](./contrib/calltree-screenshot.png)
1414

15-
# Calltree
15+
# Calltree.nvim
1616

17-
Calltree implements the missing "call-hierarchy" tree UI seen in other popular IDE's
17+
Calltree.nvim implements the missing "call-hierarchy" tree UI seen in other popular IDEs
1818
such as Pycharm and VSCode.
1919

20-
Calltree allows you to start at a root symbol and discover the callers or callees of it.
20+
Calltree.nvim allows you to start at a root symbol and discover the callers or callee's of it.
2121

22-
Subsequently, you can drill down the tree futher to discover the "callers-of-caller" or
23-
the "callees-of-callee".
22+
Subsequently, you can drill down the tree further to discover the "callers-of-caller" or
23+
the "callee's-of-callee".
2424

25-
This relationship forms a tree and this is exactly how Calltree works, keeping an in
25+
This relationship forms a tree and this is exactly how Calltree.nvim works, keeping an in
2626
memory representation of the call tree and writing the tree out to an outline form when
2727
requested.
2828

29+
Additionally, Calltree.nvim provides a live document outline UI to further help the navigation of a codebase.
30+
2931
# Usage
3032

3133
## Get it
@@ -40,26 +42,26 @@ Plug:
4042
Call the setup function from anywhere you configure your plugins from.
4143

4244
Configuration dictionary is explained in ./doc/calltree.txt (:h calltree-config)
45+
4346
```
4447
require('calltree').setup({})
4548
```
4649

4750
## Use it
4851

49-
The setup function hooks directly into the "textDocument/incomingCalls" and "textDocument/outgoingCalls"
50-
LSP handlers.
52+
The setup function hooks directly into the "textDocument/incomingCalls", "textDocument/outgoingCalls", and "textDocument/documentSymbol" LSP handlers.
5153

5254
To start a call tree use the LSP client just like you're used to:
5355

5456
```
55-
:lua vim.lsp.buf.incoming_calls
56-
:lua vim.lsp.buf.outgoing_calls
57+
:lua vim.lsp.buf.incoming_calls()
58+
:lua vim.lsp.buf.outgoing_calls()
59+
:lua vim.slp.buf.document_symbol() (symboltree outline)
5760
```
5861

5962
You most likely have key mappings set for this if you're using the lsp-config.
6063

61-
Once the calltree is open you can expand and collapse symbols to discover a total call
62-
hierarchy in an intuitative way.
64+
Once the calltree or symboltree is open you can expand and collapse symbols to discover a total call hierarchy or document outline in an intuitative way.
6365

6466
Use ":CTExpand" and ":CTCollapse" to achieve this.
6567

@@ -69,13 +71,13 @@ Check out (:h calltree) for all the details.
6971

7072
This plugin aims to be super simple and do one thing very well.
7173

72-
There are a few features which add a bit more to the basic calltree usage.
74+
There are a few features which add a bit more to the basic usage.
7375

74-
## Switching Directions
76+
## Switching Directions (calltree)
7577

76-
The ":CTSwitch" command will focus and inverse the call tree (move from outgoing to incoming for example) for the symbol under the curosor.
78+
The ":CTSwitch" command will focus and inverse the call tree (move from outgoing to incoming for example) for the symbol under the cursor.
7779

78-
## Focusing
80+
## Focusing (calltree)
7981

8082
The ":CTFocus" command will re-parent the symbol under the cursor, making it root.
8183

@@ -87,26 +89,42 @@ The ":CTHover" will show hover info for the given symbol.
8789

8890
## Jump
8991

90-
Calltree supports jumping to the symbol.
92+
Calltree.nvim supports jumping to the symbol.
9193

9294
The ":CTJump" command will do this.
9395

9496
How jumping occurs is controlled by the config, see (h: calltree-config)
9597

98+
Jumping will set highlights in the source file, to clear these use ":CTClearHL".
99+
96100
## Icons
97101

98-
Nerd font icons along with codicons are currently supported.
102+
Nerd font icons along with Codicons are currently supported.
99103

100104
You'll need a patched font for them to work correctly. see (h: calltree-config)
101105

102106
## Symbol Outline
103107

104-
Because the tree module can be used for symbols as well calltree implements a live symbol outline of the focused buffer.
108+
Because the tree module can be used for symbols as well Calltree.nvim implements a live symbol outline of the focused buffer.
105109

106110
Expanding and collapsing nodes is done with the same commands as the call hierarchy tree.
107111

108112
The UI works together and will always ensure a static layout with call hierarchy on top/left and symbols on bottom/right.
109113

114+
## Unified Panel
115+
116+
It's possible to treat Calltree.nvim's UI as a persistent but collapsible panel.
117+
118+
This would be similar to VSCode and JetBrain IDEs, where an informational panel is present on the left, bottom, right, or top of the editor depending on configuration.
119+
120+
When enabling the unified panel, both the symboltree (document symbol outline) and the calltree (any recently requested call hierarchy outline) are always displayed together.
121+
122+
The "CTPanel" command may be used to open and collapse the unified panel when desired.
123+
124+
The configuration options `unified_panel` and `auto_open_panel` can be set to true to ensure the unified panel is opened when LSP requests are made and the unified panel is opened on Neovim's start, respectively.
125+
126+
The unified panel is completely opt-in. By keeping the `unified_panel` and `auto_open_panel` options false only the respectively Calltree.nvim UI elements will open when LSP requests are made. Furthermore, you can use ":CTPanel" freely without either option above set, if you'd like to "sometimes" use the unified panel without any constraints.
127+
110128
## Demo
111129

112130
[![Calltree Demonstration]()](https://user-images.githubusercontent.com/5642902/142293639-aa0d97a1-e3b0-4fc4-942e-108bfaa18793.mp4)

doc/calltree.txt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ License: MIT license
1616
====================================================================================
1717
CONTENTS *calltree-contents*
1818

19-
1. Intro........................................|calltree-intro|
20-
2. Usage........................................|caltree-usage|
21-
3. Commands.....................................|calltree-commands|
22-
4. Mappings.....................................|calltree-mappings|
23-
5. Config.......................................|calltree-config|
24-
6. Highlights...................................|calltree-highlights|
19+
1 Intro.........................................|calltree-intro|
20+
2 Usage.........................................|caltree-usage|
21+
2.1 Unified Panel................................|calltree-unified-panel|
22+
3 Commands......................................|calltree-commands|
23+
4 Mappings......................................|calltree-mappings|
24+
5 Config........................................|calltree-config|
25+
6 Highlights....................................|calltree-highlights|
26+
6.1 Icon Highlights..............................|calltree-icon-highlights|
27+
6.2 UI Highlights................................|calltree-ui-highlights|
2528

2629
====================================================================================
2730
INTRODUCTION *calltree-intro*
@@ -65,19 +68,19 @@ and "vim.lsp.buf.outgoing_calls" will open the calltree window.
6568

6669
The calltree UI can be used as a unified panel or as individual elements.
6770

68-
A unified panel would feel similar to IDE's such as VSCode where you can "hide"
69-
and "unhide" a persistent informational panel. Both the symbol tree and the call tree will
70-
always be present in the toggled panel, unless you manually close a window.
71-
Toggling the panel will recreate any closed windows. This functionality
72-
is provided via the "CTPanel" command.
71+
*calltree-unified-panel*
7372

74-
If you'd rather use each individual component separately this is possible
75-
too. Utilize the "CTOpen/CTClose" and "STOpen/STClose" commands. These commands
76-
will only open and close the respective UI components.
73+
It's possible to treat Calltree.nvim's UI as a persistent but collapsible panel.
7774

78-
By default performing a "call-hierarchy" request for incoming or outgoing calls
79-
does not assume a unified panel. If you'd like it to open the unified panel on LSP requests
80-
then set "unified_panel" to true in the config. See *calltree-config*
75+
This would be similar to VSCode and JetBrain IDEs, where an informational panel is present on the left, bottom, right, or top of the editor depending on configuration.
76+
77+
When enabling the unified panel, both the symboltree (document symbol outline) and the calltree (any recently requested call hierarchy outline) are always displayed together.
78+
79+
The "CTPanel" command may be used to open and collapse the unified panel when desired.
80+
81+
The configuration options `unified_panel` and `auto_open_panel` can be set to true to ensure the unified panel is opened when LSP requests are made and the unified panel is opened on Neovim's start, respectively.
82+
83+
The unified panel is completely opt-in. By keeping the `unified_panel` and `auto_open_panel` options false only the respectively Calltree.nvim UI elements will open when LSP requests are made. Furthermore, you can use ":CTPanel" freely without either option above set, if you'd like to "sometimes" use the unified panel without any constraints.
8184

8285
From there check out *calltree-commands* to manipulate the calltree UI.
8386

0 commit comments

Comments
 (0)