Skip to content

Variable in for-in loop can’t be renamed using rename refactor #52149

Closed

Description

@stereotype441

Given the following code:

f(List<int> ints) {
  for (var value in ints) { // (1)
    print(value);
  }
}

Place the cursor on the identifier value on the line marked (1), and request a rename refactor.

Expected result: it should be possible to rename this variable.

Observed result: the IDE shows the message "The element can't be renamed."

I see similar behaviour with for-in collection elements, e.g.:

f(List<int> ints) => [for (var value in ints) value * 2];

Reproduced in 60fec9c.

Activity

  1. added
    P3A lower priority bug or feature request
    devexp-serverIssues related to some aspect of the analysis server
    on Apr 24, 2023
  2. self-assigned this
    on Apr 24, 2023
  3. scheglov commented on Apr 24, 2023

    @scheglov
    Contributor

    https://dart-review.googlesource.com/c/sdk/+/297900

    This looks to be an LSP specific issue.
    IntelliJ does not call the server at all 😨

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

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requestdevexp-refactorsIssues with analysis server refactorsdevexp-serverIssues related to some aspect of the analysis serverlegacy-area-analyzerUse area-devexp instead.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions