Skip to content

Go to Definition on destruction with the same name "does nothing"Β #59943

@FMorschel

Description

@FMorschel

If you have a code like the following:

class Class {
  int myField = 0;
}

void foo() {
  var instance = Class();
  if (instance case Class(:var myField)) {
    print(myField);
    print(myField);
  }
}

Using "Go to Definition" or CTRL + Click on myField at line 7 (inside if), it doesn't go to the definition in the class. Since it is also a variable definition itself, it doesn't think there is anything more to it.

By default, VS Code has a fallback at a definition (if you call that command again at that location) to show references, so it would show a list containing lines 8 and 9.

I'd like a way of getting back to the class definition for myField. In this case, this means that "Go to Definition" would take us to the definition and not "do nothing" to fall back to VS Code default.

CC @DanTup @bwilkerson @scheglov

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-serverIssues related to some aspect of the analysis serverdevexp-uxtype-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