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

Renaming to private is not possible if item is used elsewhere #2745

Closed
szotp opened this issue Aug 26, 2020 · 3 comments
Closed

Renaming to private is not possible if item is used elsewhere #2745

szotp opened this issue Aug 26, 2020 · 3 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is enhancement
Milestone

Comments

@szotp
Copy link
Contributor

szotp commented Aug 26, 2020

  1. Have two files, as described below.
  2. Attempt to rename foo into _foo.

Got:
Alert appears: Renamed top level variable will be invisible in ''.
There is no option to force the rename.

Expected:
Alert appears: Renamed top level variable will be invisible in main.dart
Alert has "Force" button that renames anyway - I would like to rename and then fix the errors.

This is especially annoying if given item is used 100x times in one file and 10x in other files, because now you have to find all references of it, remove them, and then attempt the rename again. Overall takes much longer than forced rename which we had before.

Sample files:

// main.dart
import 'other.dart';

void main(List<String> arguments) {
  print('Hello world! $foo');
}
// other.dart
var foo = 1;
@DanTup DanTup added this to the v3.15.0 milestone Aug 31, 2020
@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is enhancement labels Aug 31, 2020
@DanTup
Copy link
Member

DanTup commented Sep 24, 2020

I'm splitting this into two issues, because one is fixed but the other is a bit trickier.

The bad error message is covered by #2818, and this issue is for being able to force the rename.

@DanTup DanTup modified the milestones: v3.15.0, v3.16.0 Sep 24, 2020
@DanTup DanTup changed the title Renaming to private is not possible and confusing if item is used elsewhere Renaming to private is not possible if item is used elsewhere Sep 24, 2020
@DanTup
Copy link
Member

DanTup commented Oct 14, 2020

Got a fix in progress for LSP at https://dart-review.googlesource.com/c/sdk/+/167621/.

rename_prompt

dart-bot pushed a commit to dart-lang/sdk that referenced this issue Oct 14, 2020
Fixes Dart-Code/Dart-Code#2745.

Change-Id: Ia2770f18ebca410bce93bd2f3042e294083dc435
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167621
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
@DanTup
Copy link
Member

DanTup commented Oct 14, 2020

Fixed in dart-lang/sdk@ece17f7 and should show up in a future SDK release.

@DanTup DanTup closed this as completed Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is enhancement
Projects
None yet
Development

No branches or pull requests

2 participants