Skip to content

Add support for "Go to implementation" #446

Closed

Description

@Ravenow

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

Activity

  1. fbricon commented on Feb 16, 2018

    @fbricon
    Collaborator

    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.

  2. changed the title [-]java.show.implementations always fails[/-] [+]Add support for "Go to implementation"[/+] on Feb 16, 2018
  3. LQR86 commented on Mar 2, 2018

    @LQR86

    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.

  4. shawmanz32na commented on Mar 7, 2018

    @shawmanz32na

    @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.

  5. darkgem666 commented on Mar 8, 2018

    @darkgem666

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

  6. kainazzzo commented on Jun 7, 2018

    @kainazzzo

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

  7. self-assigned this
    on Jun 26, 2018
  8. aabuniaj commented on Aug 2, 2018

    @aabuniaj

    Any updates on this functionality?

  9. fbricon commented on Aug 2, 2018

    @fbricon
    Collaborator

    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

  10. aabuniaj commented on Aug 2, 2018

    @aabuniaj

    Thank you! I appreciate the update.

  11. fbricon commented on Aug 2, 2018

    @fbricon
    Collaborator

    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

  12. added this to the End August 2018 milestone on Aug 2, 2018
  13. fbricon commented on Aug 2, 2018

    @fbricon
    Collaborator

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

  14. 2 remaining items

  15. fbricon commented on Aug 6, 2018

    @fbricon
    Collaborator

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

  16. dbaeumer commented on Aug 15, 2018

    @dbaeumer
    Contributor

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

  17. dbaeumer commented on Aug 15, 2018

    @dbaeumer
    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.

  18. fbricon commented on Aug 29, 2018

    @fbricon
    Collaborator

    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.

  19. aabuniaj commented on Aug 30, 2018

    @aabuniaj

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

  20. fbricon commented on Aug 30, 2018

    @fbricon
    Collaborator

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

  21. amplexdenmark commented on Sep 14, 2018

    @amplexdenmark

    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?

  22. JavaHello commented on Sep 14, 2018

    @JavaHello

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

    From google translate

  23. amplexdenmark commented on Sep 20, 2018

    @amplexdenmark

    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 :-)

  24. finviman commented on Mar 18, 2019

    @finviman

    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

  25. liudonghua123 commented on Jun 13, 2019

    @liudonghua123

    It's nice to have this features.

  26. openvita commented on Oct 28, 2019

    @openvita

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

  27. fbricon commented on Oct 28, 2019

    @fbricon
    Collaborator

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

  28. meydominic commented on Nov 6, 2019

    @meydominic

    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions