Skip to content

Commit

Permalink
fixup! Fixes for Vscode emacs extension
Browse files Browse the repository at this point in the history
  • Loading branch information
vinokurig committed Dec 6, 2019
1 parent 591247f commit 37825ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
14 changes: 7 additions & 7 deletions packages/core/src/browser/keybinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import * as common from '../common/keybinding';

export enum KeybindingScope {
DEFAULT,
PLUGIN,
DEFAULT_OVERRIDING,
USER,
WORKSPACE,
END
Expand Down Expand Up @@ -189,13 +189,13 @@ export class KeybindingRegistry {
}

/**
* Register a keybinding to the registry.
* Register a default keybinding to the registry.
*
* @param binding
* @param scope keybinding scope, {@link KeybindingScope.DEFAULT} if not provided.
* @param override Override existed keybinding
*/
registerKeybinding(binding: Keybinding, scope?: KeybindingScope): Disposable {
return this.doRegisterKeybinding(binding, scope);
registerKeybinding(binding: Keybinding, override?: boolean): Disposable {
return this.doRegisterKeybinding(binding, !!override ? KeybindingScope.DEFAULT_OVERRIDING : undefined);
}

/**
Expand Down Expand Up @@ -243,7 +243,7 @@ export class KeybindingRegistry {
protected doRegisterKeybinding(binding: Keybinding, scope: KeybindingScope = KeybindingScope.DEFAULT): Disposable {
try {
this.resolveKeybinding(binding);
if (this.containsKeybinding(this.keymaps[scope], binding) && scope !== KeybindingScope.PLUGIN) {
if (this.containsKeybinding(this.keymaps[scope], binding) && scope !== KeybindingScope.DEFAULT_OVERRIDING) {
throw new Error(`"${binding.keybinding}" is in collision with something else [scope:${scope}]`);
}
this.keymaps[scope].push(binding);
Expand Down Expand Up @@ -454,7 +454,7 @@ export class KeybindingRegistry {
matches.partial = matches.partial.filter(
binding => this.getKeybindingCollisions(result.partial, binding).partial.length === 0);

if (scope === KeybindingScope.PLUGIN) {
if (scope === KeybindingScope.DEFAULT_OVERRIDING) {
matches.full.reverse();
matches.partial.reverse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
commands.registerCommand({ id: 'undo' }, {
execute: () => commands.executeCommand(CommonCommands.UNDO.id)
});
commands.registerCommand({ id: 'workbench.action.closeAllEditors' }, {
execute: () => commands.executeCommand(CommonCommands.CLOSE_ALL_TABS.id)
});
commands.registerCommand({ id: 'editor.action.startFindReplaceAction' }, {
execute: () => commands.executeCommand(CommonCommands.REPLACE.id)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { injectable, inject } from 'inversify';
import { PluginContribution, Keybinding as PluginKeybinding } from '../../../common';
import { Keybinding } from '@theia/core/lib/common/keybinding';
import { KeybindingRegistry, KeybindingScope } from '@theia/core/lib/browser/keybinding';
import { KeybindingRegistry } from '@theia/core/lib/browser/keybinding';
import { OS } from '@theia/core/lib/common/os';
import { Disposable } from '@theia/core/lib/common/disposable';
import { DisposableCollection } from '@theia/core';
Expand All @@ -36,7 +36,7 @@ export class KeybindingsContributionPointHandler {
for (const raw of contributions.keybindings) {
const keybinding = this.toKeybinding(raw);
if (keybinding) {
toDispose.push(this.keybindingRegistry.registerKeybinding(keybinding, KeybindingScope.PLUGIN));
toDispose.push(this.keybindingRegistry.registerKeybinding(keybinding, true));
}
}
return toDispose;
Expand Down

0 comments on commit 37825ae

Please sign in to comment.