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

Add Convert to 'package:' import for everywhere in file context action #3823

Closed
Luckey-Elijah opened this issue Feb 8, 2022 · 4 comments
Closed
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

@Luckey-Elijah
Copy link

Is your feature request related to a problem? Please describe.
When Working on fixing up old code that uses relative imports, many times it uses relative imports in the dart source code.

Describe the solution you'd like
I would like a context action that will Convert to 'package:' import for everywhere in file. Similar to what screen-capped is below.
Screen Shot 2022-02-08 at 10 07 32 AM

Describe alternatives you've considered
Using the same Convert to 'package:' import actions several times on a file import directives.

@DanTup DanTup added this to the v3.36.0 milestone Feb 10, 2022
@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 labels Feb 10, 2022
@DanTup
Copy link
Member

DanTup commented Feb 10, 2022

I've got a fix in progress here:

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

Screenshot 2022-02-10 at 09 56 00

The "Convert to 'package:' import" shown in your original screenshot is an assist and not a fix (which is why there's no bulk option, and it's not at the top of the list). The change applies the existing fix (of the same name) to the lint always_use_package_imports which both moves them to the top and enables bulk fixing.

@DanTup
Copy link
Member

DanTup commented Feb 10, 2022

Note: Since the fix is in the SDK, it'll actually show up in a future Dart/Flutter SDK release and not a VS Code extension release (these fixes are powered by the Dart language server in the SDK).

I'll close this issue once that change is merged into the SDK.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Feb 10, 2022
…ge_imports lint

Fixes Dart-Code/Dart-Code#3823.

Change-Id: I33d1448b36de1927e3e3cc5628d0d822d4f21786
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232265
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
@DanTup
Copy link
Member

DanTup commented Feb 10, 2022

The fix landed in the SDK in dart-lang/sdk@74248dc.

@DanTup DanTup closed this as completed Feb 10, 2022
@Luckey-Elijah
Copy link
Author

Thank you very much!

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