lsp-treemacs-call-hierarchy shows something like this:
f
main
The above does not say where in main, that f is called. It also does not show how many locations in main have calls to f. It is a minor issue for this small test program, but if it were a big project, main might have hundreds of lines which is where my suggested enhancement would be really useful.
To be specific I would prefer it to say:
f
main line 4
main line 5
Double-clicking on the row saying main currently moves the cursor to line 3 which is the header line of main. Naturally, I prefer it to move the cursor to inside the body at line 4 or 5 depending on which line was clicked.
clangd appears to give enough info to Emacs to allow the greater detail I request. Below I marked lines 3 and line 4 in bold. I think the LSP protocol refers to the first line in the file as line 0. That is why it says the calls to f are on lines 3 and 4. Since Emacs assigns the first line as line 1, then Emacs would simply need to add 1 to the line number that clangd gives to get lines 4 and 5 like in my example tree above.
I[17:33:20.129] <-- textDocument/prepareCallHierarchy(167)
V[17:33:20.129] ASTWorker running CallHierarchy on version 49 of /home/bjacob/backup/C++/tests/a.cpp
I[17:33:20.129] --> reply:textDocument/prepareCallHierarchy(167) 0 ms
V[17:33:20.129] >>> {"id":167,"jsonrpc":"2.0","result":[{"data":"B3A9EC6BECD5869C","kind":12,"name":"f","range":{"end":{"character":11,"line":0},"start":{"character":0,"line":0}},"selectionRange":{"end":{"character":6,"line":0},"start":{"character":5,"line":0}},"uri":"file:///home/bjacob/backup/C%2B%2B/tests/a.cpp"}]}
For this file:
lsp-treemacs-call-hierarchy shows something like this:
The above does not say where in
main
, thatf
is called. It also does not show how many locations inmain
have calls tof
. It is a minor issue for this small test program, but if it were a big project,main
might have hundreds of lines which is where my suggested enhancement would be really useful.To be specific I would prefer it to say:
Double-clicking on the row saying main currently moves the cursor to line 3 which is the header line of main. Naturally, I prefer it to move the cursor to inside the body at line 4 or 5 depending on which line was clicked.
clangd appears to give enough info to Emacs to allow the greater detail I request. Below I marked lines 3 and line 4 in bold. I think the LSP protocol refers to the first line in the file as line 0. That is why it says the calls to
f
are on lines 3 and 4. Since Emacs assigns the first line as line 1, then Emacs would simply need to add 1 to the line number that clangd gives to get lines 4 and 5 like in my example tree above.Thanks.