Skip to content

Commit

Permalink
Fix types on CopyPasteController.get (#200600)
Browse files Browse the repository at this point in the history
Fixes #200597
  • Loading branch information
mjbvz authored Dec 12, 2023
1 parent 61c2876 commit fec4c8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/clipboard/browser/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fec4c8e

Please sign in to comment.