Skip to content

Commit 5136342

Browse files
authored
Patch crashing explorer on paste (microsoft#200396) (microsoft#200402)
* Patch crashing explorer on paste * Write filename to clipboard
1 parent add891b commit 5136342

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/vs/workbench/contrib/files/browser/explorerService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ export class ExplorerService implements IExplorerService {
286286
const previouslyCutItems = this.cutItems;
287287
this.cutItems = cut ? items : undefined;
288288
await this.clipboardService.writeResources(items.map(s => s.resource));
289+
if (items.length === 1) {
290+
await this.clipboardService.writeText(items[0].name);
291+
}
289292

290293
this.view?.itemsCopied(items, cut, previouslyCutItems);
291294
}

src/vs/workbench/contrib/files/browser/fileActions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,12 @@ export const pasteFileHandler = async (accessor: ServicesAccessor, fileList?: Fi
11241124
const element = context.length ? context[0] : explorerService.roots[0];
11251125
const incrementalNaming = configurationService.getValue<IFilesConfiguration>().explorer.incrementalNaming;
11261126

1127+
const editableItem = explorerService.getEditable();
1128+
// If it's an editable item, just do nothing
1129+
if (editableItem) {
1130+
return;
1131+
}
1132+
11271133
try {
11281134
// Check if target is ancestor of pasted folder
11291135
const sourceTargetPairs = coalesce(await Promise.all(toPaste.map(async fileToPaste => {

0 commit comments

Comments
 (0)