Skip to content

Record fields are not syntax highlighted #4908

@navaronbracke

Description

@navaronbracke

Is your feature request related to a problem? Please describe.
Currently, when using records with named fields, the names of the fields are not highlighted like regular field accessors.

Consider the sample:

void foo() {
  const ({bool someField}) rec = (someField: false);

  final bool myBool = rec.someField;
}

image

Describe the solution you'd like
Have named fields of records highlighted the same way as fields / local variables.
Since named fields in methods and constructors get highlighted in blue, I propose we do the following:

  1. Highlight the named fields of records at the declaration site (LHS of the code sample).
    This brings it in line with named fields for methods/constructors.

  2. Highlight the named field access when using the field.
    This brings it in line with regular usage of class fields and (local) variables.

Describe alternatives you've considered
N/A

Additional context
Dart-Code v3.78.2
Flutter (Channel stable, 3.16.0, on Microsoft Windows [Version 10.0.19045.3803], locale nl-BE)
• Flutter version 3.16.0 on channel stable at E:\Documenten\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db7ef5bf9f (5 weeks ago), 2023-11-15 11:25:44 -0800
• Engine revision 74d16627b9
• Dart version 3.2.0
• DevTools version 2.28.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions