提交 aad61e8a 编写于 作者: A al 提交者: Alex Dima

Add JSON schema for args in keybindings.json

上级 af2bd48a
......@@ -573,6 +573,24 @@ let schema: IJSONSchema = {
'id': schemaId,
'type': 'array',
'title': nls.localize('keybindings.json.title', "Keybindings configuration"),
'definitions': {
'editorGroups': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
'groups': {
'$ref': '#/definitions/editorGroups',
'default': [{}, {}]
},
'size': {
'type': 'number',
'default': 0.5
}
}
}
}
},
'items': {
'required': ['key'],
'type': 'object',
......@@ -593,7 +611,329 @@ let schema: IJSONSchema = {
'args': {
'description': nls.localize('keybindings.json.args', "Arguments to pass to the command to execute.")
}
}
},
'allOf': [{
'if': {
'properties': {
'command': { 'const': 'vscode.openFolder' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['path'],
'properties': {
'path': {
'type': 'string'
},
}
}
}
}
}, {
'if': {
'properties': {
'command': { 'const': 'vscode.setEditorLayout' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['groups'],
'properties': {
'orientation': {
'type': 'number',
'default': 0,
'enum': [0, 1]
},
'groups': {
'$ref': '#/definitions/editorGroups',
'default': [{}, {}]
}
}
}
}
}
}, {
'if': {
'properties': {
'command': { 'const': 'editor.action.codeAction' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['kind'],
'properties': {
'kind': {
'type': 'string'
},
'apply': {
'type': 'string',
'default': 'ifSingle',
'enum': ['first', 'ifSingle', 'never']
}
}
}
}
}
}, {
'if': {
'properties': {
'command': { 'enum': ['editor.action.refactor', 'editor.action.sourceAction'] },
}
},
'then': {
'properties': {
'args': {
'type': 'object',
'properties': {
'kind': {
'type': 'string'
},
'apply': {
'type': 'string',
'default': 'never',
'enum': ['first', 'ifSingle', 'never']
}
}
}
}
}
}, {
'if': {
'properties': {
'command': { 'const': 'workbench.action.tasks.runTask' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'string',
}
}
}
}, {
'if': {
'properties': {
'command': { 'enum': ['workbench.action.terminal.sendSequence', 'type'] },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['text'],
'properties': {
'text': {
'type': 'string'
}
},
}
}
}
},
{
'if': {
'properties': {
'command': { 'const': 'editor.action.insertSnippet' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'properties': {
'snippet': {
'type': 'string'
},
'langId': {
'type': 'string',
},
'name': {
'type': 'string'
}
},
}
}
}
},
{
'if': {
'properties': {
'command': { 'const': 'moveActiveEditor' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['to'],
'properties': {
'to': {
'type': 'string',
'enum': ['left', 'right']
},
'by': {
'type': 'string',
'enum': ['tab', 'group']
},
'value': {
'type': 'number'
}
},
}
}
}
},
{
'if': {
'properties': {
'command': { 'const': 'editorScroll' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['to'],
'properties': {
'to': {
'type': 'string',
'enum': ['up', 'down']
},
'by': {
'type': 'string',
'enum': ['line', 'wrappedLine', 'page', 'halfPage']
},
'value': {
'type': 'number',
'default': 1
},
'revealCursor': {
'type': 'boolean',
}
}
}
}
}
},
{
'if': {
'properties': {
'command': { 'const': 'revealLine' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['lineNumber'],
'properties': {
'lineNumber': {
'type': 'number',
},
'at': {
'type': 'string',
'enum': ['top', 'center', 'bottom']
}
}
}
}
}
},
{
'if': {
'properties': {
'command': { 'const': 'cursorMove' },
}
},
'then': {
'required': ['args'],
'properties': {
'args': {
'type': 'object',
'required': ['to'],
'properties': {
'to': {
'type': 'string',
'enum': ['left', 'right', 'up', 'down', 'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter', 'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter', 'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside']
},
'by': {
'type': 'string',
'enum': ['line', 'wrappedLine', 'character', 'halfLine']
},
'value': {
'type': 'number',
'default': 1
},
'select': {
'type': 'boolean',
'default': false
}
}
}
}
}
},
{
'if': {
'properties': {
'command': { 'enum': ['editor.fold', 'editor.unfold'] },
}
},
'then': {
'properties': {
'args': {
'type': 'object',
'properties': {
'levels': {
'type': 'number',
'default': 1
},
'direction': {
'type': 'string',
'enum': ['up', 'down'],
'default': 'down'
},
'selectionLines': {
'type': 'array',
'items': {
'type': 'number'
}
}
}
}
}
}
},
{
'if': {
'properties': {
'command': { 'const': 'workbench.action.quickOpen' }
}
},
'then': {
'properties': {
'args': {
'type': 'string'
}
}
}
}]
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册