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 Nov 26, 2019
1 parent dad0ff8 commit 0462391
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
19 changes: 10 additions & 9 deletions packages/core/src/browser/keybinding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('keybindings', () => {
expect(bindings.partial.length > 0);
});

it('should not register a shadowing keybinding', () => {
it('should register a shadowing keybinding', () => {
const validKeyBinding = 'ctrlcmd+b a';
const command = TEST_COMMAND_SHADOW.id;
const keybindingShadowing: Keybinding[] = [
Expand All @@ -270,22 +270,22 @@ describe('keybindings', () => {
keybindingRegistry.registerKeybindings(...keybindingShadowing);

const bindings = keybindingRegistry.getKeybindingsForCommand(command);
expect(bindings.length).to.be.equal(1);
expect(bindings.length).to.be.equal(2);
expect(bindings[0].keybinding).to.be.equal(validKeyBinding);
});

it('shadowed bindings should not be returned', () => {
it('shadowed bindings should also be returned', () => {
const keyCode = KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Shift] });
let bindings: Keybinding[];

const ignoredDefaultBinding: Keybinding = {
const defaultBinding: Keybinding = {
keybinding: keyCode.toString(),
command: 'test.ignored-command'
command: 'test.workspace-command'
};

const defaultBinding: Keybinding = {
const secondDefaultBinding: Keybinding = {
keybinding: keyCode.toString(),
command: 'test.workspace-command'
command: 'test.second-command'
};

const userBinding: Keybinding = {
Expand All @@ -298,7 +298,7 @@ describe('keybindings', () => {
command: 'test.workspace-command'
};

keybindingRegistry.setKeymap(KeybindingScope.DEFAULT, [defaultBinding, ignoredDefaultBinding]);
keybindingRegistry.setKeymap(KeybindingScope.DEFAULT, [defaultBinding, secondDefaultBinding]);
keybindingRegistry.setKeymap(KeybindingScope.USER, [userBinding]);
keybindingRegistry.setKeymap(KeybindingScope.WORKSPACE, [workspaceBinding]);
// now WORKSPACE bindings are overriding the other scopes
Expand All @@ -318,8 +318,9 @@ describe('keybindings', () => {
// and finally it should fallback to DEFAULT bindings.

bindings = keybindingRegistry.getKeybindingsForKeySequence([keyCode]).full;
expect(bindings).to.have.lengthOf(1);
expect(bindings).to.have.lengthOf(2);
expect(bindings[0].command).to.be.equal(defaultBinding.command);
expect(bindings[1].command).to.be.equal(secondDefaultBinding.command);

keybindingRegistry.resetKeybindingsForScope(KeybindingScope.DEFAULT);
// now the registry should be empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,9 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
commands.registerCommand({ id: 'undo' }, {
execute: () => commands.executeCommand(CommonCommands.UNDO.id)
});
commands.registerCommand({ id: 'workbench.action.quickOpen' }, {
execute: () => commands.executeCommand(CommonCommands.UNDO.id)
});
commands.registerCommand({ id: 'workbench.action.closeAllEditors' }, {
execute: () => commands.executeCommand(CommonCommands.CLOSE_ALL_TABS.id)
});

commands.registerCommand({ id: 'workbench.action.quickOpen' }, {
execute: () => this.quickOpen.open('')
});
Expand Down

0 comments on commit 0462391

Please sign in to comment.