Skip to content

Way to Go From Method Implementation to Interface Method Declaration #14588

Open

Description

@mjbvz

From microsoft/vscode#22385

TypeScript Version: 2.2.1

Code

interface ITest {
    test(): void;
}

class Test implements ITest {
    test() {
        return null;
    }
}

Request
Running go to definition on test in class Test currently does not return ITest::test. Neither does go to type definition.

In VSCode, we would like some way to jump from a class's interface method implementation or abstract method implementation to the interface method declaration or abstract method declaration itself. I'm not sure which command makes sense to do this, either go to definition or go to type definition, but we are open to any suggestions

Activity

  1. RyanCavanaugh commented on Mar 13, 2017

    @RyanCavanaugh
    Member

    FWIW the "Find All References" command already does this. I think what you essentially want here is "Find all referencing declarations", which would be trivial to implement.

  2. pkeuter commented on Mar 13, 2017

    @pkeuter

    What I think would be a nice addition to vscode is that you could jump from the implementation of an interface to the Interface method itself. There are two options now: "go to definition" and "go to type definition", and they both give a "not found" error. Which, in my opinion, could be better.

  3. mhegazy commented on Aug 29, 2017

    @mhegazy
    Contributor

    i do not think this is a definition. what about a class that overrides a declaration? what about an object literal that really defines this function?

    i think go to type seems more reasonable here.

  4. mjbvz commented on Jan 21, 2021

    @mjbvz
    ContributorAuthor

    VS Code now has a go to declaration feature. While I believe it was originally added for c++, it may make sense for this use case in TS

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureDomain: LS: Symbol NavigationRelates to go-to-definition, find-all-references, highlighting/occurrences.SuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions