Open elextr opened 9 months ago
Done. I also implemented "go to implementations" (e.g. classes implementing a superclass/interface). There are keybindings for this, menu items under the LSP menu, and also entries in the context menu.
Ready for testing :-).
Thanks, will test.
Ok, goto type seems to work from limited testing. Find implementation seems to do nothing. I notice Vscode does not have that (at least for C++), maybe its something for other languages.
Hmmmm, ok "find implementation" provides a list of declarations of overrides of virtual functions, but the "implementation" is the definition, not the declaration.
What I found is Vscode "hides" this as part of "goto declaration" and "goto definition" so it knows which you want, and if there is only one answer it goes to it directly, else it provides an inset list as described here
Hmmmm, ok "find implementation" provides a list of declarations of overrides of virtual functions, but the "implementation" is the definition, not the declaration.
Yes, it's those methods implementing an interface.
What I found is Vscode "hides" this as part of "goto declaration" and "goto definition" so it knows which you want, and if there is only one answer it goes to it directly, else it provides an inset list as described https://github.com/techee/geany-lsp/issues/21#issue-1989722527
Well, there is "Go to Implementations" in vscode which does just this. I decided to feed the results into the message window because in this case (and also in the case of references), there are typically more results and the whole thing behaves more like "find" than "goto". And then I found it a little strange that for one item it goes somewhere directly so in this case I display this single item instead of going to it immediately.
Yes, it's those methods implementing an interface.
My complaint is that clang is giving me the declarations of those implementations, not the definitions which actually do the implementing and I can't choose which I want to see. The Vscode Menu->Go->Go to implementations
does not do anything here. Edit: with the cursor in the same position as generated the inset of #21
This is a follow on from this.
Geany has
goto declaration
andgoto definition
but Vscode also hasgoto type definition
as per this LSP message.Use case:
In code
Foo* something(); auto p = something(); p->foo
thefoo
is red wriggly underlined and the hover says "No member named 'foo' in 'Foo'".As discussed in the link above goto on
foo
will do nothing, its not visible here, lets see whatsp
(hovers) oh, its aFoo*
, triesgoto definition
getsauto p
bah!!! and same for goto declaration, but in Vscodegoto type definition
lands onclass Foo
where its obvious the member isgoo
notfoo
, woo hoo ;-PIn this simple example it would be possible to
goto definition
ofp
thengoto definition
ofsomething()
to findFoo
which cangoto declaration
and get toclass Foo
. But thats a number of steps and it is only a simple sequence, it could easily get longer and the sequence would be blocked ifsomething()
return type was inferred or was a template parameter, then there would not be aFoo
written down to follow.