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 16, 2020
1 parent 52dd9cd commit 18dae15
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 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
1 change: 1 addition & 0 deletions 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 Down

0 comments on commit 18dae15

Please sign in to comment.