Skip to content

Record fields are not syntax highlighted #4908

Closed

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

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Dec 19, 2023
  2. changed the title [-][Proposal] Adjust the highlights for record named fields[/-] [+]Record fields are not syntax highlighted[/+] on Jan 10, 2024
  3. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    and removed
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Jan 10, 2024
  4. added this to the v3.82.0 milestone on Jan 10, 2024
  5. DanTup commented on Jan 10, 2024

    @DanTup
    Member

    Fixed by dart-lang/sdk@0d6dd73. The change ships inside the Dart/Flutter SDKs, so it'll show up in a future SDK release (not a Dart-Code extension release).

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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