提交 0ae072e1 编写于 作者: J Joao Moreno

expose workbenchState context key

related to #35031
上级 bc174a73
......@@ -135,6 +135,14 @@ const Identifiers = {
STATUSBAR_PART: 'workbench.parts.statusbar'
};
function getWorkbenchStateString(state: WorkbenchState): string {
switch (state) {
case WorkbenchState.EMPTY: return 'empty';
case WorkbenchState.FOLDER: return 'folder';
case WorkbenchState.WORKSPACE: return 'workspace';
}
}
/**
* The workbench creates and lays out all parts that make up the workbench.
*/
......@@ -269,6 +277,11 @@ export class Workbench implements IPartService {
this.inZenMode = InZenModeContext.bindTo(this.contextKeyService);
this.sideBarVisibleContext = SidebarVisibleContext.bindTo(this.contextKeyService);
// Set workbench state context
const WorkbenchStateContext = new RawContextKey<string>('workbenchState', getWorkbenchStateString(this.configurationService.getWorkbenchState()));
const workbenchStateContext = WorkbenchStateContext.bindTo(this.contextKeyService);
this.toDispose.push(this.configurationService.onDidChangeWorkbenchState(() => workbenchStateContext.set(getWorkbenchStateString(this.configurationService.getWorkbenchState()))));
// Register Listeners
this.registerListeners();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册