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

Patch crashing explorer on paste #200396

Merged
merged 2 commits into from Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/vs/workbench/contrib/files/browser/explorerService.ts
Expand Up @@ -286,6 +286,9 @@ export class ExplorerService implements IExplorerService {
const previouslyCutItems = this.cutItems;
this.cutItems = cut ? items : undefined;
await this.clipboardService.writeResources(items.map(s => s.resource));
if (items.length === 1) {
await this.clipboardService.writeText(items[0].name);
}

this.view?.itemsCopied(items, cut, previouslyCutItems);
}
Expand Down
6 changes: 6 additions & 0 deletions src/vs/workbench/contrib/files/browser/fileActions.ts
Expand Up @@ -1124,6 +1124,12 @@ export const pasteFileHandler = async (accessor: ServicesAccessor, fileList?: Fi
const element = context.length ? context[0] : explorerService.roots[0];
const incrementalNaming = configurationService.getValue<IFilesConfiguration>().explorer.incrementalNaming;

const editableItem = explorerService.getEditable();
// If it's an editable item, just do nothing
if (editableItem) {
return;
}

try {
// Check if target is ancestor of pasted folder
const sourceTargetPairs = coalesce(await Promise.all(toPaste.map(async fileToPaste => {
Expand Down