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

Dragging multiple files/folders are once does not update import statements #4533

Closed
lukehutch opened this issue May 9, 2023 · 5 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

@lukehutch
Copy link

Describe the bug

If I drag a dart file from one folder to another in VSCode with Dart-Code, the imports of other dart files that depend upon that file are not updated (i.e. the imports end up broken).

Expected behavior

Import paths should be updated when files are moved.

Please complete the following information:

  • Operating System and version: Linux
  • VS Code version: code-1.78.0-1683145689.el7.x86_64
  • Dart extension version: Latest
  • Dart/Flutter SDK version: Dart SDK version: 2.19.4 (stable) (Tue Mar 7 09:58:46 2023 +0000) on "linux_x64"
  • Target device (if the issue relates to Flutter debugging):
@lukehutch
Copy link
Author

lukehutch commented May 9, 2023

Correction: sometimes imports are updated, sometimes they are not. I haven't figured out under which circumstances the imports are not updated.

@DanTup
Copy link
Member

DanTup commented May 10, 2023

@lukehutch is it when you're dragging multiple items at once? Currently we only support moving a single "item" at a time.

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label May 10, 2023
@lukehutch
Copy link
Author

Yes, it was while moving multiple items. I couldn't reproduce it later because I was moving a single item at a time.

@DanTup
Copy link
Member

DanTup commented May 15, 2023

Thanks for confirming. This is a known limitation of the rename. I thought there was an issue already open tracking this but I can't find one (here or in the SDK) so I'll keep this open for that. Unfortunately it's not a trivial fix.

@DanTup DanTup added this to the On Deck milestone May 15, 2023
@DanTup DanTup added is enhancement in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server and removed is bug awaiting info Requires more information from the customer to progress labels May 15, 2023
@DanTup DanTup changed the title Dragging a dart file into another folder does not update dependent imports Dragging multiple files/folders are once does not update import statements May 15, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Oct 11, 2023
We already supported moving a single folder, which we expanded to each file inside it. This adds support for moving multiple distinct items at the same time (eg. dragging multiple files).

To support this, we need to track a full mapping of source/destination paths (because files might be moved from different levels into the same level - we can't compute destination paths from a single `newFile` variable), and also build a unique set of references that need updating (rather than building edits as we go - where we might try to edit the same reference from both ends).

Fixes Dart-Code/Dart-Code#4533

This is currently only supported for LSP.

Change-Id: I3a8ab8b2dcb13451111d38d2ec0e2f69d6084e28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
@DanTup DanTup modified the milestones: On Deck, Requires SDK Release Nov 27, 2023
@DanTup
Copy link
Member

DanTup commented Nov 27, 2023

This is fixed by dart-lang/sdk@09f3eb0 and will ship in a future SDK release.

@DanTup DanTup closed this as completed Nov 27, 2023
@DanTup DanTup modified the milestones: Requires SDK Release, v3.84.0 Feb 22, 2024
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