sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Missing quickfix "update import" when `hide` is used in `import`

Open zoechi opened this issue 8 years ago • 6 comments

image

when I comment out hide user

image

I get the "update import" option, but I think I should also get it when hide User is there.

zoechi avatar Aug 20 '17 14:08 zoechi

Agreed. We need to update FixProcessor._addFix_importLibrary_withElement to understand hide clauses.

bwilkerson avatar Jan 28 '18 16:01 bwilkerson

Another question, what happens when the user tries to expose the 'hidden' function, e.g.

import 'dart:math' hide max show min;

void f() {
  max(1, 2);
}

Should we say: Update library import, or Unhide 'max'?


The requester test case:

import 'dart:math' hide atan show min;

void f() {
  max(1, 2);
}

should have 'Update library import' to add max, instead of 'Import library'

asashour avatar Sep 10 '21 15:09 asashour

The labels for a fix (or assist) should describe what it's going to do. We could say "Update import of ''", or we could be more specific about how it's going to be updated and say something like "Show '' from '' or "Unhide '' from ''" depending on how the import will be updated.

For something like

import 'dart:math' hide max show min;

void f() {
  max(1, 2);
}

We actually need to do both: remove the hide clause and add max to the show clause. (I suspect that having both a hide and show clause is rare though, so I'm not sure it's worth having a third message for it.)

bwilkerson avatar Sep 23 '21 22:09 bwilkerson

We actually need to do both: remove the hide clause and add max to the show clause. (I suspect that having both a hide and show clause is rare though, so I'm not sure it's worth having a third message for it.)

In this case the "update" would be fine I think.

Just to point out: some work related to show is being worked on https://github.com/Dart-Code/Dart-Code/issues/5238.

FMorschel avatar Aug 30 '24 22:08 FMorschel

I just would like to point out that there is an issue for warning when you have either two combinations of show/hide since you only need one to achieve any hiding goal

You never need more than one show or one hide combinator to achieve any hiding-goal.

From @lrhn's comment on #56879

FMorschel avatar Oct 18 '24 20:10 FMorschel

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

FMorschel avatar Oct 19 '24 06:10 FMorschel