Skip to content

Commit

Permalink
Do not consider standaloneKeybindingService as nullable
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Nikitenko <[email protected]>
  • Loading branch information
RomanNikitenko committed Mar 5, 2020
1 parent c91b213 commit 02ae87b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
10 changes: 0 additions & 10 deletions packages/monaco/src/browser/monaco-editor-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion packages/monaco/src/typings/monaco/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 02ae87b

Please sign in to comment.