Fix types on CopyPasteController.get (#200600)

Fixes #200597
This commit is contained in:
Matt Bierner
2023-12-12 11:39:31 -08:00
committed by GitHub
parent 61c2876943
commit fec4c8e5bb
2 changed files with 3 additions and 3 deletions
@@ -229,7 +229,7 @@ if (PasteAction) {
if (focusedEditor && focusedEditor.hasTextFocus()) {
const result = focusedEditor.getContainerDomNode().ownerDocument.execCommand('paste');
if (result) {
return CopyPasteController.get(focusedEditor).finishedPaste();
return CopyPasteController.get(focusedEditor)?.finishedPaste() ?? Promise.resolve();
} else if (platform.isWeb) {
// Use the clipboard service if document.execCommand('paste') was not successful
return (async () => {
@@ -51,8 +51,8 @@ export class CopyPasteController extends Disposable implements IEditorContributi
public static readonly ID = 'editor.contrib.copyPasteActionController';
public static get(editor: ICodeEditor): CopyPasteController {
return editor.getContribution<CopyPasteController>(CopyPasteController.ID)!;
public static get(editor: ICodeEditor): CopyPasteController | null {
return editor.getContribution<CopyPasteController>(CopyPasteController.ID);
}
private readonly _editor: ICodeEditor;