Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
stereotype441 opened this issue Apr 24, 2023 · 1 comment
Closed
Assignees
Labels
analyzer-refactoring analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request

Comments

@stereotype441
Copy link
Member

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.

@stereotype441 stereotype441 added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-refactoring labels Apr 24, 2023
@scheglov scheglov added P3 A lower priority bug or feature request analyzer-server labels Apr 24, 2023
@scheglov scheglov self-assigned this Apr 24, 2023
@scheglov
Copy link
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 😨

copybara-service bot pushed a commit that referenced this issue Apr 24, 2023
…r with LSP.

Bug: #52149
Change-Id: Ia4c5c564cc44583741722c658389ea674a5643c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-refactoring analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request
Projects
None yet
Development

No branches or pull requests

2 participants