提交 36439ca5 编写于 作者: J Johannes Rieken

when printing commands for keybindings, skip those that declare arguments and...

when printing commands for keybindings, skip those that declare arguments and those that start with `vscode.', fixes #4915.
上级 13738403
...@@ -10,12 +10,13 @@ import {IHTMLContentElement} from 'vs/base/common/htmlContent'; ...@@ -10,12 +10,13 @@ import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import {KeyCode, Keybinding} from 'vs/base/common/keyCodes'; import {KeyCode, Keybinding} from 'vs/base/common/keyCodes';
import {IDisposable, dispose} from 'vs/base/common/lifecycle'; import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import Severity from 'vs/base/common/severity'; import Severity from 'vs/base/common/severity';
import {isFalsyOrEmpty} from 'vs/base/common/arrays';
import {TPromise} from 'vs/base/common/winjs.base'; import {TPromise} from 'vs/base/common/winjs.base';
import * as dom from 'vs/base/browser/dom'; import * as dom from 'vs/base/browser/dom';
import {IKeyboardEvent, StandardKeyboardEvent} from 'vs/base/browser/keyboardEvent'; import {IKeyboardEvent, StandardKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {KeybindingResolver} from 'vs/platform/keybinding/common/keybindingResolver'; import {KeybindingResolver} from 'vs/platform/keybinding/common/keybindingResolver';
import {ICommandHandler, IKeybindingContextKey, IKeybindingItem, IKeybindingScopeLocation, IKeybindingService, SET_CONTEXT_COMMAND_ID} from 'vs/platform/keybinding/common/keybindingService'; import {ICommandHandler, ICommandHandlerDescription, IKeybindingContextKey, IKeybindingItem, IKeybindingScopeLocation, IKeybindingService, SET_CONTEXT_COMMAND_ID} from 'vs/platform/keybinding/common/keybindingService';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry'; import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {IMessageService} from 'vs/platform/message/common/message'; import {IMessageService} from 'vs/platform/message/common/message';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration'; import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
...@@ -258,10 +259,25 @@ export abstract class KeybindingService extends AbstractKeybindingService implem ...@@ -258,10 +259,25 @@ export abstract class KeybindingService extends AbstractKeybindingService implem
} }
private _getAllCommandsAsComment(): string { private _getAllCommandsAsComment(): string {
let boundCommands = this._getResolver().getDefaultBoundCommands(); const commands = KeybindingsRegistry.getCommands();
let unboundCommands = Object.keys(KeybindingsRegistry.getCommands()).filter(commandId => commandId[0] !== '_' && !boundCommands[commandId]); const unboundCommands: string[] = [];
unboundCommands.sort(); const boundCommands = this._getResolver().getDefaultBoundCommands();
let pretty = unboundCommands.join('\n// - ');
for (let id in commands) {
if (id[0] === '_' || id.indexOf('vscode.') === 0) { // private command
continue;
}
if (typeof commands[id].description === 'object'
&& !isFalsyOrEmpty((<ICommandHandlerDescription>commands[id].description).args)) { // command with args
continue;
}
if (boundCommands[id]) {
continue;
}
unboundCommands.push(id);
}
let pretty = unboundCommands.sort().join('\n// - ');
return '// ' + nls.localize('unboundCommands', "Here are other available commands: ") + '\n// - ' + pretty; return '// ' + nls.localize('unboundCommands', "Here are other available commands: ") + '\n// - ' + pretty;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册