Skip to content

Go to definition does not find a definition in typescript #22385

Closed

Description

@pkeuter
  • VSCode Version: 1.10.2
  • OS Version: Win10 x64

Steps to Reproduce:

  1. Create a .ts file with this content:
interface ITest {
    test(): void;
}

class Test implements ITest {
    test() {
        return null;
    }
}
  1. Right click on the test() implementation and click 'go to definition'. It will say there is "no definition found for 'test'". I expected it to go to the definition.

Go to implementation from the interface does work.

Activity

  1. added
    *questionIssue represents a question, should be posted to StackOverflow (VS Code)
    *as-designedDescribed behavior is as designed
    info-neededIssue requires more information from poster
    and removed
    *questionIssue represents a question, should be posted to StackOverflow (VS Code)
    on Mar 10, 2017
  2. mjbvz commented on Mar 10, 2017

    @mjbvz
    Contributor

    The current behavior seems correct to me. If you right click on test in Test, you are already at the definition of the method.

    Are you expecting it to go to ITest test instead?

  3. pkeuter commented on Mar 10, 2017

    @pkeuter
    Author

    Yes, because test() in Test is the implementation, isn't it, and test() in ITest is the definition? I would say it's a good thing to let the user be able to go to the Interface from the implementation. From what I see, there is no way now to go directly to the Interface declaration from the class implementation, is there?

  4. added
    upstreamIssue identified as 'upstream' component related (exists outside of VS Code)
    and removed
    info-neededIssue requires more information from poster
    on Mar 10, 2017
  5. mjbvz commented on Mar 10, 2017

    @mjbvz
    Contributor

    No not currently.

    I'm still not sure that go to definition should go to the interface declaration in this case, but perhaps go to type definition should do what you describe?

    I've opened microsoft/TypeScript#14588 against TypeScript to track this and discuss the design of this feature

    Thanks.

  6. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*as-designedDescribed behavior is as designedtypescriptTypescript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions