Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "Go to implementation" #446

Closed
Ravenow opened this issue Feb 16, 2018 · 26 comments
Closed

Add support for "Go to implementation" #446

Ravenow opened this issue Feb 16, 2018 · 26 comments

Comments

@Ravenow
Copy link

Ravenow commented Feb 16, 2018

Hello. Im new to vscode and java extension. I wanna see all implementation of target interface, like in jetbrains idea (crtl+alt+b). I setted up ctrl+alt+b for command java.show.implementations, but it always fail. IMHO thats strange becase implementationsCodeLens works fine. Any help?

Thanks.

Environment
  • Operating System: fedora 27
  • JDK version: 1.8.0.161
  • Visual Studio Code version: 1.20.1
  • Java extension version: 0.19.0
Additional Informations

2018-02-16 22-03-20

@fbricon
Copy link
Collaborator

fbricon commented Feb 16, 2018

The current java.show.implementations command is actually internal, not designed to be called manually from the UI, or be bound to a shortcut.

However, VSCode now has a show implementation shortcut (Ctrl+F12) (see microsoft/vscode#18346), so we should eventually be able to plug into that mechanism, but it's not been standardized yet.

@fbricon fbricon changed the title java.show.implementations always fails Add support for "Go to implementation" Feb 16, 2018
@LQR86
Copy link

LQR86 commented Mar 2, 2018

Also, it seems that "Go to super definition(or go to super method)" command doesn't exist in VSCode. And I really need it when navigating through Java or any other object-oriented code. Sigh.

@shawmanz32na
Copy link

@fbricon Unless I'm misreading, both the dependency issues you listed are now merged/closed. Can this get put on the queue of things to do?

I'd love to be able to quickly navigate to implementing classes.

@darkgem666
Copy link

It looks the new update for VSCode has now the implementation for this, can we please make this happen?

@kainazzzo
Copy link

I would also like this feature a lot. I've switched to VS code for all my java projects but miss this feature mostly.

@aabuniaj
Copy link

aabuniaj commented Aug 2, 2018

Any updates on this functionality?

@fbricon
Copy link
Collaborator

fbricon commented Aug 2, 2018

I'm working on it. It should be available in a CI build next week and should be generally available for the end of August release

@aabuniaj
Copy link

aabuniaj commented Aug 2, 2018

Thank you! I appreciate the update.

@fbricon
Copy link
Collaborator

fbricon commented Aug 2, 2018

BTW the find implementors behavior in VSCode is a bit weird, always opens the 1st result then displays the list under that result: microsoft/vscode#55603

@fbricon fbricon added this to the End August 2018 milestone Aug 2, 2018
@fbricon
Copy link
Collaborator

fbricon commented Aug 2, 2018

@jrieken I can't seem to be able to cancel textDocument/implementation queries. Is it me or a limitation in vscode?

@jrieken
Copy link

jrieken commented Aug 6, 2018

@dbaeumer or @aeschli should know

@aeschli
Copy link
Collaborator

aeschli commented Aug 6, 2018

@fbricon Can you elaborate? Cancel would be initiated by the UI and signaled to the server through the LSP. Are you saying it doesn't arrive on the server?

@fbricon
Copy link
Collaborator

fbricon commented Aug 6, 2018

@aeschli indeed I don't see any cancellation event when hitting esc while implementation search is running

@dbaeumer
Copy link
Contributor

This is implemented generically as soon as a request provides a cancelation token.

@dbaeumer
Copy link
Contributor

I tested this and pressing Esc when Goto Implementation is executed doesn't cancel the request. Please file an issue against VS Code itself so cancelation can be implemented there.

@fbricon
Copy link
Collaborator

fbricon commented Aug 29, 2018

Opened microsoft/vscode#57537 for the cancellation issue.
The issue with the 1st result being opened is now microsoft/vscode#31046

For the rest, the feature seems to work as expected.

Please note that java.lang.Object is treated as a special case. Since it will always return a huge list of results, precise location is disabled. Results will always point to Line 1, Char 1, so as to avoid opening thousands of files to compute the actual type location.

@fbricon fbricon closed this as completed Aug 29, 2018
@aabuniaj
Copy link

Is this feature available to try? How can I get it to test it out?

@fbricon
Copy link
Collaborator

fbricon commented Aug 30, 2018

@aabuniaj you can download and install the latest java-*.vsix build from http://download.jboss.org/jbosstools/jdt.ls/staging/?C=M;O=D

@amplexdenmark
Copy link

I just tried this, installed java-0.31.0-1204.vsix
But it does not work for me hitting cmd+12 (Mac) or selecting "Go to implementation" from the menu both shows "No implementation found for: "
But "Go to definition" works and takes me to the interface and my implementation class is right next to it in the same folder.
Must I do something to enable this feature?

@JavaHello
Copy link

I am very happy that this feature is ready to use.

From google translate

@amplexdenmark
Copy link

Okay, I figured out how this works.
But IMO it can be improved.

If you are placed on method call to an interface and select "Go to implementation" it will show you "No implementation found...", what you need to do is first select "Go to Definition" which navigates to the method definition in the interface and here you can select "Go to implementation" which correctly navigates to the implementation.

I had hoped this was a one step process, usually I do not care about the definition, and it opens an extra file in my workspace.

But it is still nice to be able to do it at all :-)

@finviman
Copy link

yes, in VSCode, " Go to Definition" first and then "Go to implementation" works fine.
But i'm using coc.nvim in neovim, everytime i open a java project, "Go to Definition" works fine, but "Go to implementation" doesn't work at first time, after i call it serveral times, it begin works and works fine after that. i don't know why. i have installed the latest snapshot of jdt.ls

@liudonghua123
Copy link

It's nice to have this features.

@openvita
Copy link

Would be nice to have this feature. VSCode for Java rocks !

@fbricon
Copy link
Collaborator

fbricon commented Oct 28, 2019

@openvita see keymapping in vscode:
Screen Shot 2019-10-28 at 3 09 49 PM

@meydominic
Copy link

I'm on version 0.52 but it's not working:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests