> The sidebar symbols both offer goto-implementation (click on a function) and 
> calltips (mouse-over tooltip). But in the sidebar you don't have a cursor 
> position. I do not see how you can possibly implement the two functionalities 
> using the LSP interfaces designed for that purposes, but using the intended 
> interfaces - and only those - is [@techee](https://github.com/techee) entire 
> argument.

> So to my understanding both sidebar features have to be implemented using the 
> fallback.

I think you misunderstand the purpose of the goto-implementation, signature and 
documentSymbol calls:
- goto-implementation: this is only meant to be used for control-click on an 
identifier in the editor (or using a keybinding for the symbol at the cursor 
position) - then, based on the identifier location in the current file, the 
server tries to find where that symbol is defined. clang is pretty good at that 
and really returns the right one, taking into account includes, type 
hierarchies etc. This is something that is extremely hard to do without full 
AST information.
- signature - like goto-implementation, this is triggered e.g. by `(` and the 
LSP server evaluates the identifier in front of `(`, its visibility from the 
precise location in the editor, and returns the best possible calltip. Again, 
extremely hard to do without AST.
- autocompletion - like above

Now documentSymbol:
- returns current document's symbols, their locations, the "detail" field I 
mentioned several times above and kind of the symbol. These are trivial to 
interpret so if one wants to display "detail" as calltip, one can do it (I do 
it with my plugin for the sidebar). Or go to symbol for this list is also 
trivial to implement. There's no need for server assistance here and LSP leaves 
these trivial things on clients. This is no "fallback" as you call it, you can 
do whatever you wish with the symbols obtained using this call.

> But the fallback, as proposed in this PR, relies entirely on TM backed by 
> ctags parsing. 

No, this PR uses `documentSymbol` symbols for the sidebar (shows symbol name in 
the tree, shows "detail" as the calltip, generates tree based on children and 
assigns icon based on kind). I was just suggesting that if this PR is 
considered too big, I could sacrifice this LSP feature and could live with the 
TM implementation. 

> I can believe that you or @techee don't care about goto-implementation and 
> calltips enough on the sidebar but I do.

But this works, I really don't know what you are talking about. Have you 
actually tried the bloody plugin? It's a few minutes of your time to install 
and test it - would really save hours of pointless discussions.

> Hopefully it won't do nothing if I accidentally call a private function that 
> is not available from the call site in question. I still want to jump to the 
> implementation in that case.

Try it and see how clangd behaves. I would expect it to be reasonably fuzzy. 
When we mention "accurate", we mean that when you have hundreds of methods 
called `get()` in your C++ project, the goto will jump to the right one instead 
of showing a list of 100 `get`s.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3571#issuecomment-1793807970
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3571/[email protected]>

Reply via email to