Skip to content

Go to Implementations command to show the declaration if not abstract #62031

@FMorschel

Description

@FMorschel

If you request Go to Implementations on an abstract member, and there is a concrete implementation for it, you get directly moved there by VS Code (if you have more than one, it will show Peek, and you can choose an implementation to open). This command works both in the declaration or invocation of the member (in this case, A.doSomething).

If the method is not abstract, this command gives no results. This creates a small UX problem, because if I want to see the implementation of the methods below, the most consistent way of doing it is either Go to Definition and then Go to Implementations (if abstract) or try Go to Implementations first (in a package like analyzer this is what I tend to do since most classes are abstract) and if nothing happens, to Go to Definition.

But if the definition is in itself an implementation, I was expecting the Go to Implementations command to return that instead of nothing.

Repro:

abstract class A {
  void doSomething();
}

class B implements A {
  @override
  void doSomething() {
    print('Doing something in class B');
  }
}

class C {
  void performAction() {
    print('Performing action in class C');
  }
}

void foo(A a, C c) {
  a.doSomething();   // Request `Go to Implementations` get moved to B.doSomething
  c.performAction(); // Request `Go to Implementations` get `No implementation found for 'performAction'` message
}

CC @bwilkerson @DanTup

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-navigationtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions