-
Notifications
You must be signed in to change notification settings - Fork 62
fix: reopens files that were opened when dragging and dropping files or folders #1704
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
base: main
Are you sure you want to change the base?
Conversation
611c04f to
5d54593
Compare
…or folders Signed-off-by: tariku <[email protected]>
5d54593 to
802bd3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes file reopening behavior when dragging and dropping files or folders in the Content Navigator. It ensures that previously opened files are reopened at their new locations after a move operation, and prevents VSCode from incorrectly opening folders as files.
Key Changes:
- Modified the
moveTohandling logic to track closed files as an array instead of a boolean - Added a new
calculateNewFileUrimethod to compute new URIs for files that were moved - Implemented logic to reopen all previously opened files after a successful move operation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: tariku <[email protected]>
82a3dc9 to
af2da9a
Compare
|
Hey @tarikutk . Is there a github issue associated with this PR? Or rather, what issue is this solving? |
| const newUri = await this.model.moveTo(item, targetUri); | ||
| if (closing !== true) { | ||
| commands.executeCommand("vscode.open", newUri); | ||
| if (Array.isArray(closedFiles) && closedFiles.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With drag and drop, at the moment, we call moveItem for each item dragged, and we call closeFileIfOpen for one item. And, newUri should be returned after the item is moved.
Is there an issue where the newUri is wrong? If that's the case, this should be happening at the model level
| isContainer as getIsContainer, | ||
| } from "./utils"; | ||
|
|
||
| const SAS_FILE_SEPARATOR = "~fs~"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw, this is sas server specific. Anything that is specific to connection type should happen in the adapter if possible.
Summary:
Testing:
verified it opens previously opened files instead of opening a folder as a file.