提交 f16e6aa6 编写于 作者: A Alex Dima

Add `setContext` command

上级 5b063780
......@@ -15,7 +15,7 @@ import * as dom from 'vs/base/browser/dom';
import {IKeyboardEvent, StandardKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {KeybindingResolver} from 'vs/platform/keybinding/common/keybindingResolver';
import {ICommandHandler, IKeybindingContextKey, IKeybindingItem, IKeybindingScopeLocation, IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {ICommandHandler, IKeybindingContextKey, IKeybindingItem, IKeybindingScopeLocation, IKeybindingService, SET_CONTEXT_COMMAND_ID} from 'vs/platform/keybinding/common/keybindingService';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {IMessageService} from 'vs/platform/message/common/message';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
......@@ -363,6 +363,14 @@ export abstract class KeybindingService extends AbstractKeybindingService implem
this._configurationContext.fillInContext(args.context);
}
if (commandId === SET_CONTEXT_COMMAND_ID) {
var contextKey = String(args[0]);
var contextValue = args[1];
this.setContext(contextKey, contextValue);
return TPromise.as(null);
}
return this._invokeHandler(commandId, args);
}
}
......
......@@ -338,3 +338,5 @@ export interface IKeybindingService {
executeCommand<T>(commandId: string, args?: any): TPromise<T>;
executeCommand(commandId: string, args?: any): TPromise<any>;
}
export const SET_CONTEXT_COMMAND_ID = 'setContext';
......@@ -93,9 +93,9 @@ export class ExtHostCommands {
let result = callback.apply(thisArg, args);
return Promise.resolve(result);
} catch (err) {
console.log(err);
// try {
// console.log(toErrorMessage(err));
// console.log(err);
// } catch (err) {
// //
// }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册