dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.11k stars 1.56k forks source link

Unable to rename import prefix from outsite the import line #56809

Open FMorschel opened 1 day ago

FMorschel commented 1 day ago

When you have the following code:

import 'dart:math' as math;

math.Random? r;

If you go to the math at the line of the import and press F2 (rename) you can rename the prefix.

If you do the same from the third line, before the .Random you can't.

I volunteer to try and fix this.


CC: @DanTup

dart-github-bot commented 1 day ago

Summary: The issue is that the Dart IDE's rename functionality does not work when renaming an import prefix from outside the import line. This makes it difficult to refactor code when the prefix is used in multiple places.

FMorschel commented 1 day ago

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