Skip to content

Field destructing completion shows no results when file is not formatted #61920

@FMorschel

Description

@FMorschel

I'm not exactly sure what the parser/resolver is doing here, but I could not come up with a simpler repro:

import 'package:analyzer/dart/ast/ast.dart';

void f(ClassMember member) {
  if (member
      case 
          FieldDeclaration(fields: VariableDeclarationList(
            :^
          ))) {
          
  }
}

Interestingly, the same code but with a different formatting:

import 'package:analyzer/dart/ast/ast.dart';

void f(ClassMember member) {
  if (member case FieldDeclaration(fields: VariableDeclarationList(:^))) {}
}

Works as intended.

I'll look into this. I've tested it superficially, and it seems to be a simple fix. The difference between these is that the first case is trying to add completion in a PatternFieldName after the colon (which we currently don't handle), and the second case is trying to add completion in a PatternField.

FYI @bwilkerson @srawlins

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions