Skip to content

iterated variable in for..in loops no longer highlighted #4521

@jason-downs

Description

@jason-downs

Until a couple months or so ago, if you had something like:

for (final element in listOfStuff) {....}

when the cursor is on element, all instances of that in the loop are highlighted, as vscode normally highlights variables. But recently it has stopped. If the cursor is on listOfStuff, the highlighting still works as expected, but nothing is highlighted when it's on element. See screenshot:

Screenshot 2023-05-04 at 11 38 35 AM

What used to happen (and I think what is supposed to still happen?) is that element should be highlighted, including where the cursor currently is, along with the two places it's used inside the loop. But you can see that's not happening.

Additionally, if you do put the cursor on one of them inside the loop, both instances inside the loop are highlighted (as expected) but the one in the 'for-in' line still is not highlighted.

Screenshot 2023-05-04 at 11 38 54 AM

I don't know if this is even a dart code extensions problem, or something with vscode itself, or something where a default setting was changed that I need to change in settings json, but no amount of googling has helped. I have depended on this code highlighting a ton previously so this change is really throwing me off.

  • Operating System and version: macOS Ventura 13.3.1
  • VS Code version: 1.78.0
  • Dart extension version: 3.62.0
  • Dart/Flutter SDK version: Dart v.2.19.6, Flutter v.3.7.12
  • Target device (if the issue relates to Flutter debugging): n/a

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