Skip to content

Commit

Permalink
Fixes #42851: Pass undefined as command args when keybinding doesn't …
Browse files Browse the repository at this point in the history
…have argss
  • Loading branch information
alexdima committed May 2, 2018
1 parent 0f4a19e commit 08f8a48
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
if (!resolveResult.bubble) {
shouldPreventDefault = true;
}
this._commandService.executeCommand(resolveResult.commandId, resolveResult.commandArgs || {}).done(undefined, err => {
this._commandService.executeCommand(resolveResult.commandId, resolveResult.commandArgs).done(undefined, err => {
this._notificationService.warn(err);
});
/* __GDPR__
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/keybinding/common/keybindingsRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
this._keybindings.push({
keybinding: keybinding,
command: commandId,
commandArgs: null,
commandArgs: undefined,
when: when,
weight1: weight1,
weight2: weight2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ suite('AbstractKeybindingService', () => {
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [{}]
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
Expand Down Expand Up @@ -303,7 +303,7 @@ suite('AbstractKeybindingService', () => {
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [{}]
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
Expand Down Expand Up @@ -334,7 +334,7 @@ suite('AbstractKeybindingService', () => {
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
commandId: 'chordCommand',
args: [{}]
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
Expand Down Expand Up @@ -363,7 +363,7 @@ suite('AbstractKeybindingService', () => {
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [{}]
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
Expand All @@ -381,7 +381,7 @@ suite('AbstractKeybindingService', () => {
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [{}]
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
Expand Down Expand Up @@ -421,7 +421,7 @@ suite('AbstractKeybindingService', () => {
assert.equal(shouldPreventDefault, false);
assert.deepEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [{}]
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class KeybindingIO {
const [firstPart, chordPart] = (typeof input.key === 'string' ? this._readUserBinding(input.key) : [null, null]);
const when = (typeof input.when === 'string' ? ContextKeyExpr.deserialize(input.when) : null);
const command = (typeof input.command === 'string' ? input.command : null);
const commandArgs = (typeof input.args !== 'undefined' ? input.args : null);
const commandArgs = (typeof input.args !== 'undefined' ? input.args : undefined);
return {
firstPart: firstPart,
chordPart: chordPart,
Expand Down

0 comments on commit 08f8a48

Please sign in to comment.