Skip to content

No document highlights for object patterns #92

@gnprice

Description

@gnprice

Previously https://youtrack.jetbrains.com/issue/IDEA-367915 , previously dart-lang/sdk#53478.

Quoting the previous issue by @DanTup, adapted slightly:

Describe the bug
Highlighting of related tokens in the document does not seem to work for Dart object patterns.

Given the following code:

final MapEntry(:key) = const MapEntry<String, int>('a', 1);
print(key);
if (const MapEntry('a', 1) case MapEntry(:final key)) {
  print(key);
}

Putting the cursor on "MapEntry" correctly highlights the other references:
Image

However doing the same for "key" highlights nothing:
Image

My understanding [i.e., @DanTup's] is that IntelliJ uses the navigation data from the Dart server for this, however if I Ctrl+Click on "key" on line 22, it navigates to where the cursor is on line 21 in the screenshot, so I believe this data is present.

To Reproduce
Steps to reproduce the behavior:

  1. Paste in the code above
  2. Put the cursor on an instance of "key"

Expected behavior
All related instances of "key" should be highlighted

Actual behavior
Nothing is highlighted

Screenshots
(see above)

Version information

  • Dart plugin version: 242.24931
  • IDE platform version: Android Studio Ladybug Feature Drop | 2024.2.2 Patch 1
  • OS: Windows 11
  • Flutter version: (unspecified in previous report, but I @gnprice am still seeing it with Flutter 3.39.0-0.1.pre, commit flutter/flutter@83382d1bb9)

Error messages / Logs / Other context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions