From 02ae87b8f87849e4b787e2d78f461ea57c163848 Mon Sep 17 00:00:00 2001 From: Roman Nikitenko Date: Thu, 5 Mar 2020 14:55:51 +0200 Subject: [PATCH] Do not consider standaloneKeybindingService as nullable Signed-off-by: Roman Nikitenko --- packages/monaco/src/browser/monaco-editor-provider.ts | 10 ---------- packages/monaco/src/typings/monaco/index.d.ts | 3 ++- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/monaco/src/browser/monaco-editor-provider.ts b/packages/monaco/src/browser/monaco-editor-provider.ts index a5961ea88c882..a67d873a88840 100644 --- a/packages/monaco/src/browser/monaco-editor-provider.ts +++ b/packages/monaco/src/browser/monaco-editor-provider.ts @@ -164,11 +164,6 @@ export class MonacoEditorProvider { protected suppressMonacoKeybindingListener(editor: MonacoEditor): void { let keydownListener: monaco.IDisposable | undefined; const keybindingService = editor.getControl()._standaloneKeybindingService; - if (!keybindingService) { - console.warn('Cannot suppresses Monaco keydown listener because KeybindingService is not recognized'); - return; - } - for (const listener of keybindingService._store._toDispose) { if ('_type' in listener && listener['_type'] === 'keydown') { keydownListener = listener; @@ -182,11 +177,6 @@ export class MonacoEditorProvider { protected injectKeybindingResolver(editor: MonacoEditor): void { const keybindingService = editor.getControl()._standaloneKeybindingService; - if (!keybindingService) { - console.warn('Cannot inject Keybinding Resolver because KeybindingService is not recognized'); - return; - } - keybindingService.resolveKeybinding = keybinding => [new MonacoResolvedKeybinding(MonacoResolvedKeybinding.keySequence(keybinding), this.keybindingRegistry)]; keybindingService.resolveKeyboardEvent = keyboardEvent => { const keybinding = new monaco.keybindings.SimpleKeybinding( diff --git a/packages/monaco/src/typings/monaco/index.d.ts b/packages/monaco/src/typings/monaco/index.d.ts index c0a70f919b23c..3e0f982e85210 100644 --- a/packages/monaco/src/typings/monaco/index.d.ts +++ b/packages/monaco/src/typings/monaco/index.d.ts @@ -47,6 +47,7 @@ declare module monaco.editor { readonly range: Range; } + // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/standalone/browser/standaloneCodeEditor.ts#L205 export interface IStandaloneCodeEditor extends CommonCodeEditor { setDecorations(decorationTypeKey: string, ranges: IDecorationOptions[]): void; setDecorationsFast(decorationTypeKey: string, ranges: IRange[]): void; @@ -57,7 +58,7 @@ declare module monaco.editor { } resolveKeybinding(keybinding: monaco.keybindings.ChordKeybinding): monaco.keybindings.ResolvedKeybinding[]; resolveKeyboardEvent(keyboardEvent: monaco.IKeyboardEvent): monaco.keybindings.ResolvedKeybinding; - } | null + } } // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/browser/widget/codeEditorWidget.ts#L104