Revert "Add logging for early returns in copy and paste handling (#282989)"

This reverts commit 39b0686add.
This commit is contained in:
Alex Dima
2026-01-08 11:24:52 +01:00
parent d162db1465
commit 0c38ca07f3

View File

@@ -182,7 +182,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
this._logService.trace('CopyPasteController#handleCopy');
}
if (!this._editor.hasTextFocus()) {
this._logService.trace('CopyPasteController#handleCopy/earlyReturn1');
return;
}
@@ -192,14 +191,12 @@ export class CopyPasteController extends Disposable implements IEditorContributi
this._clipboardService.clearInternalState?.();
if (!e.clipboardData || !this.isPasteAsEnabled()) {
this._logService.trace('CopyPasteController#handleCopy/earlyReturn2');
return;
}
const model = this._editor.getModel();
const selections = this._editor.getSelections();
if (!model || !selections?.length) {
this._logService.trace('CopyPasteController#handleCopy/earlyReturn3');
return;
}
@@ -209,7 +206,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
const wasFromEmptySelection = selections.length === 1 && selections[0].isEmpty();
if (wasFromEmptySelection) {
if (!enableEmptySelectionClipboard) {
this._logService.trace('CopyPasteController#handleCopy/earlyReturn4');
return;
}
@@ -230,7 +226,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
.filter(x => !!x.prepareDocumentPaste);
if (!providers.length) {
this.setCopyMetadata(e.clipboardData, { defaultPastePayload });
this._logService.trace('CopyPasteController#handleCopy/earlyReturn5');
return;
}
@@ -259,7 +254,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
CopyPasteController._currentCopyOperation?.operations.forEach(entry => entry.operation.cancel());
CopyPasteController._currentCopyOperation = { handle, operations };
this._logService.trace('CopyPasteController#handleCopy/end');
}
private async handlePaste(e: ClipboardEvent) {
@@ -271,7 +265,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
this._logService.trace('CopyPasteController#handlePaste');
}
if (!e.clipboardData || !this._editor.hasTextFocus()) {
this._logService.trace('CopyPasteController#handlePaste/earlyReturn1');
return;
}
@@ -282,7 +275,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
const model = this._editor.getModel();
const selections = this._editor.getSelections();
if (!selections?.length || !model) {
this._logService.trace('CopyPasteController#handlePaste/earlyReturn2');
return;
}
@@ -290,7 +282,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
this._editor.getOption(EditorOption.readOnly) // Never enabled if editor is readonly.
|| (!this.isPasteAsEnabled() && !this._pasteAsActionContext) // Or feature disabled (but still enable if paste was explicitly requested)
) {
this._logService.trace('CopyPasteController#handlePaste/earlyReturn3');
return;
}
@@ -333,7 +324,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
e.preventDefault();
e.stopImmediatePropagation();
}
this._logService.trace('CopyPasteController#handlePaste/earlyReturn4');
return;
}
@@ -348,7 +338,6 @@ export class CopyPasteController extends Disposable implements IEditorContributi
} else {
this.doPasteInline(allProviders, selections, dataTransfer, metadata, e);
}
this._logService.trace('CopyPasteController#handlePaste/end');
}
private showPasteAsNoEditMessage(selections: readonly Selection[], preference: PastePreference) {