remove workbench mode concept (#294985)

* remove workbench mode concept

* clean up completely
This commit is contained in:
Sandeep Somavarapu
2026-02-12 19:15:10 +01:00
committed by GitHub
parent 27abe96390
commit 13ea41dc8f
14 changed files with 6 additions and 357 deletions

View File

@@ -384,8 +384,6 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d
const telemetry = gulp.src('.build/telemetry/**', { base: '.build/telemetry', dot: true });
const workbenchModes = gulp.src('resources/workbenchModes/**', { base: '.', dot: true });
const jsFilter = util.filter(data => !data.isDirectory() && /\.js$/.test(data.path));
const root = path.resolve(path.join(import.meta.dirname, '..'));
const productionDependencies = getProductionDependencies(root);
@@ -420,7 +418,6 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d
license,
api,
telemetry,
workbenchModes,
sources,
deps
);

View File

@@ -1,28 +0,0 @@
{
"name": "Agent Sessions",
"settings": {
"chat.agentsControl.clickBehavior": "focus",
"chat.agentsControl.enabled": true,
"chat.agent.maxRequests": 1000,
"chat.restoreLastPanelSession": true,
"chat.unifiedAgentsBar.enabled": true,
"diffEditor.renderSideBySide": false,
"diffEditor.hideUnchangedRegions.enabled": true,
"files.autoSave": "afterDelay",
"github.copilot.chat.claudeCode.enabled": true,
"github.copilot.chat.languageContext.typescript.enabled": true,
"inlineChat.affordance": "editor",
"inlineChat.renderMode": "hover",
"workbench.activityBar.location": "top",
"workbench.editor.restoreEditors": false,
"workbench.editor.showTabs": "single",
"workbench.sideBar.location": "right",
"workbench.statusBar.visible": false,
"workbench.secondarySideBar.forceMaximized": true,
"workbench.secondarySideBar.defaultVisibility": "maximized",
"workbench.startupEditor": "none",
"workbench.tips.enabled": false,
"workbench.layoutControl.type": "toggles",
"workbench.activityBar.autoHide": true
}
}

View File

@@ -222,7 +222,6 @@ class StandaloneEnvironmentService implements IEnvironmentService {
readonly keyboardLayoutResource: URI = URI.from({ scheme: 'monaco', authority: 'keyboardLayoutResource' });
readonly argvResource: URI = URI.from({ scheme: 'monaco', authority: 'argvResource' });
readonly untitledWorkspacesHome: URI = URI.from({ scheme: 'monaco', authority: 'untitledWorkspacesHome' });
readonly builtinWorkbenchModesHome: URI = URI.from({ scheme: 'monaco', authority: 'builtinWorkbenchModesHome' });
readonly workspaceStorageHome: URI = URI.from({ scheme: 'monaco', authority: 'workspaceStorageHome' });
readonly localHistoryHome: URI = URI.from({ scheme: 'monaco', authority: 'localHistoryHome' });
readonly cacheHome: URI = URI.from({ scheme: 'monaco', authority: 'cacheHome' });

View File

@@ -58,7 +58,6 @@ export interface IEnvironmentService {
workspaceStorageHome: URI;
localHistoryHome: URI;
cacheHome: URI;
builtinWorkbenchModesHome: URI;
// --- settings sync
userDataSyncHome: URI;

View File

@@ -107,9 +107,6 @@ export abstract class AbstractNativeEnvironmentService implements INativeEnviron
@memoize
get untitledWorkspacesHome(): URI { return URI.file(join(this.userDataPath, 'Workspaces')); }
@memoize
get builtinWorkbenchModesHome(): URI { return joinPath(URI.file(this.appRoot), 'resources', 'workbenchModes'); }
@memoize
get builtinExtensionsPath(): string {
const cliBuiltinExtensionsDir = this.args['builtin-extensions-dir'];

View File

@@ -6,7 +6,7 @@
import { Disposable } from '../../base/common/lifecycle.js';
import { IContextKeyService, IContextKey, setConstant as setConstantContextKey } from '../../platform/contextkey/common/contextkey.js';
import { IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } from '../../platform/contextkey/common/contextkeys.js';
import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, AuxiliaryBarMaximizedContext, InAutomationContext, IsAgentSessionsWorkspaceContext, WorkbenchModeContext } from '../common/contextkeys.js';
import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, AuxiliaryBarMaximizedContext, InAutomationContext, IsAgentSessionsWorkspaceContext } from '../common/contextkeys.js';
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from '../services/editor/common/editorGroupsService.js';
import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
import { IWorkbenchEnvironmentService } from '../services/environment/common/environmentService.js';
@@ -23,7 +23,6 @@ import { getTitleBarStyle } from '../../platform/window/common/window.js';
import { mainWindow } from '../../base/browser/window.js';
import { isFullscreen, onDidChangeFullscreen } from '../../base/browser/browser.js';
import { IEditorService } from '../services/editor/common/editorService.js';
import { IWorkbenchModeService } from '../services/layout/common/workbenchModeService.js';
export class WorkbenchContextKeysHandler extends Disposable {
@@ -49,7 +48,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
private virtualWorkspaceContext: IContextKey<string>;
private temporaryWorkspaceContext: IContextKey<boolean>;
private isAgentSessionsWorkspaceContext: IContextKey<boolean>;
private workbenchModeContext: IContextKey<string>;
private inAutomationContext: IContextKey<boolean>;
private inZenModeContext: IContextKey<boolean>;
@@ -79,7 +77,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService,
@IWorkingCopyService private readonly workingCopyService: IWorkingCopyService,
@IWorkbenchModeService private readonly workbenchModeService: IWorkbenchModeService,
) {
super();
@@ -99,8 +96,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
this.temporaryWorkspaceContext = TemporaryWorkspaceContext.bindTo(this.contextKeyService);
this.isAgentSessionsWorkspaceContext = IsAgentSessionsWorkspaceContext.bindTo(this.contextKeyService);
this.isAgentSessionsWorkspaceContext.set(!!this.contextService.getWorkspace().isAgentSessionsWorkspace);
this.workbenchModeContext = WorkbenchModeContext.bindTo(this.contextKeyService);
this.workbenchModeContext.set(this.workbenchModeService.workbenchMode ?? '');
this.updateWorkspaceContextKeys();
// Capabilities
@@ -232,8 +227,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
this.updateWorkspaceContextKeys();
}));
this._register(this.workbenchModeService.onDidChangeWorkbenchMode(mode => this.workbenchModeContext.set(mode ?? '')));
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('workbench.editor.openSideBySideDirection')) {
this.updateSplitEditorsVerticallyContext();

View File

@@ -98,8 +98,6 @@ import { INotificationService, Severity } from '../../platform/notification/comm
import { IDefaultAccountService } from '../../platform/defaultAccount/common/defaultAccount.js';
import { DefaultAccountService } from '../services/accounts/browser/defaultAccount.js';
import { AccountPolicyService } from '../services/policies/common/accountPolicyService.js';
import { WorkbenchModeService } from '../services/layout/browser/workbenchModeService.js';
import { IWorkbenchModeService } from '../services/layout/common/workbenchModeService.js';
export class BrowserMain extends Disposable {
@@ -389,15 +387,6 @@ export class BrowserMain extends Disposable {
//
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Layout Mode
const workbenchModeService: WorkbenchModeService = this._register(new WorkbenchModeService(configurationService, fileService, environmentService, uriIdentityService, logService, storageService));
serviceCollection.set(IWorkbenchModeService, workbenchModeService);
try {
await workbenchModeService.initialize();
} catch (error) {
logService.error('Error while initializing workbench mode service', error);
}
// Workspace Trust Service
const workspaceTrustEnablementService = new WorkspaceTrustEnablementService(configurationService, environmentService);
serviceCollection.set(IWorkspaceTrustEnablementService, workspaceTrustEnablementService);

View File

@@ -35,8 +35,6 @@ export const TemporaryWorkspaceContext = new RawContextKey<boolean>('temporaryWo
export const IsAgentSessionsWorkspaceContext = new RawContextKey<boolean>('isAgentSessionsWorkspace', false, localize('isAgentSessionsWorkspace', "Whether the current workspace is the agent sessions workspace."));
export const WorkbenchModeContext = new RawContextKey<string>('workbenchMode', '', localize('workbenchMode', "The current workbench mode."));
export const HasWebFileSystemAccess = new RawContextKey<boolean>('hasWebFileSystemAccess', false, true); // Support for FileSystemAccess web APIs (https://wicg.github.io/file-system-access)
export const EmbedderIdentifierContext = new RawContextKey<string | undefined>('embedderIdentifier', undefined, localize('embedderIdentifier', 'The identifier of the embedder according to the product service, if one is defined'));

View File

@@ -11,16 +11,14 @@ import { INativeEnvironmentService } from '../../../../../platform/environment/c
import { IFileService } from '../../../../../platform/files/common/files.js';
import { INativeHostService } from '../../../../../platform/native/common/native.js';
import { ChatEntitlementContextKeys } from '../../../../services/chat/common/chatEntitlementService.js';
import { IWorkbenchModeService } from '../../../../services/layout/common/workbenchModeService.js';
import { IsAgentSessionsWorkspaceContext, WorkbenchModeContext } from '../../../../common/contextkeys.js';
import { CHAT_CATEGORY } from '../../browser/actions/chatActions.js';
import { ProductQualityContext } from '../../../../../platform/contextkey/common/contextkeys.js';
export class OpenAgentSessionsWindowAction extends Action2 {
export class OpenSessionsWindowAction extends Action2 {
constructor() {
super({
id: 'workbench.action.openAgentSessionsWindow',
title: localize2('openAgentSessionsWindow', "Open Agent Sessions Window"),
id: 'workbench.action.openSessionsWindow',
title: localize2('openSessionsWindow', "Open Sessions Window"),
category: CHAT_CATEGORY,
precondition: ContextKeyExpr.and(ProductQualityContext.notEqualsTo('stable'), ChatEntitlementContextKeys.Setup.hidden.negate()),
f1: true,
@@ -47,47 +45,3 @@ export class OpenAgentSessionsWindowAction extends Action2 {
await nativeHostService.openWindow([{ workspaceUri }], { forceNewWindow: true });
}
}
export class SwitchToAgentSessionsModeAction extends Action2 {
constructor() {
super({
id: 'workbench.action.switchToAgentSessionsMode',
title: localize2('switchToAgentSessionsMode', "Switch to Agent Sessions Mode"),
category: CHAT_CATEGORY,
precondition: ContextKeyExpr.and(
ProductQualityContext.notEqualsTo('stable'),
ChatEntitlementContextKeys.Setup.hidden.negate(),
IsAgentSessionsWorkspaceContext.toNegated(),
WorkbenchModeContext.notEqualsTo('agent-sessions')
),
f1: true,
});
}
async run(accessor: ServicesAccessor) {
const workbenchModeService = accessor.get(IWorkbenchModeService);
await workbenchModeService.setWorkbenchMode('agent-sessions');
}
}
export class SwitchToNormalModeAction extends Action2 {
constructor() {
super({
id: 'workbench.action.switchToNormalMode',
title: localize2('switchToNormalMode', "Switch to Default Mode"),
category: CHAT_CATEGORY,
precondition: ContextKeyExpr.and(
ProductQualityContext.notEqualsTo('stable'),
ChatEntitlementContextKeys.Setup.hidden.negate(),
IsAgentSessionsWorkspaceContext.toNegated(),
WorkbenchModeContext.notEqualsTo('')
),
f1: true,
});
}
async run(accessor: ServicesAccessor) {
const workbenchModeService = accessor.get(IWorkbenchModeService);
await workbenchModeService.setWorkbenchMode(undefined);
}
}

View File

@@ -35,7 +35,7 @@ import { registerChatDeveloperActions } from './actions/chatDeveloperActions.js'
import { registerChatExportZipAction } from './actions/chatExportZip.js';
import { HoldToVoiceChatInChatViewAction, InlineVoiceChatAction, KeywordActivationContribution, QuickVoiceChatAction, ReadChatResponseAloud, StartVoiceChatAction, StopListeningAction, StopListeningAndSubmitAction, StopReadAloud, StopReadChatItemAloud, VoiceChatInChatViewAction } from './actions/voiceChatActions.js';
import { NativeBuiltinToolsContribution } from './builtInTools/tools.js';
import { OpenAgentSessionsWindowAction, SwitchToAgentSessionsModeAction, SwitchToNormalModeAction } from './agentSessions/agentSessionsActions.js';
import { OpenSessionsWindowAction } from './agentSessions/agentSessionsActions.js';
class ChatCommandLineHandler extends Disposable {
@@ -194,9 +194,7 @@ class ChatLifecycleHandler extends Disposable {
}
}
registerAction2(OpenAgentSessionsWindowAction);
registerAction2(SwitchToAgentSessionsModeAction);
registerAction2(SwitchToNormalModeAction);
registerAction2(OpenSessionsWindowAction);
registerAction2(StartVoiceChatAction);
registerAction2(VoiceChatInChatViewAction);

View File

@@ -65,8 +65,6 @@ import { IDefaultAccountService } from '../../platform/defaultAccount/common/def
import { DefaultAccountService } from '../services/accounts/browser/defaultAccount.js';
import { AccountPolicyService } from '../services/policies/common/accountPolicyService.js';
import { MultiplexPolicyService } from '../services/policies/common/multiplexPolicyService.js';
import { WorkbenchModeService } from '../services/layout/browser/workbenchModeService.js';
import { IWorkbenchModeService } from '../services/layout/common/workbenchModeService.js';
export class DesktopMain extends Disposable {
@@ -324,16 +322,6 @@ export class DesktopMain extends Disposable {
})
]);
// Workbench Mode
const workbenchModeService: WorkbenchModeService = this._register(new WorkbenchModeService(configurationService, fileService, environmentService, uriIdentityService, logService, storageService));
serviceCollection.set(IWorkbenchModeService, workbenchModeService);
try {
await workbenchModeService.initialize();
} catch (error) {
logService.error('Error while initializing workbench mode service', error);
}
// Workspace Trust Service
const workspaceTrustEnablementService = new WorkspaceTrustEnablementService(configurationService, environmentService);
serviceCollection.set(IWorkspaceTrustEnablementService, workspaceTrustEnablementService);

View File

@@ -138,9 +138,6 @@ export class BrowserWorkbenchEnvironmentService implements IBrowserWorkbenchEnvi
@memoize
get untitledWorkspacesHome(): URI { return joinPath(this.userRoamingDataHome, 'Workspaces'); }
@memoize
get builtinWorkbenchModesHome(): URI { return joinPath(this.userRoamingDataHome, 'builtinWorkbenchModes'); }
@memoize
get serviceMachineIdResource(): URI { return joinPath(this.userRoamingDataHome, 'machineid'); }

View File

@@ -1,167 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Emitter, Event } from '../../../../base/common/event.js';
import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
import { IFileService } from '../../../../platform/files/common/files.js';
import { IEnvironmentService } from '../../../../platform/environment/common/environment.js';
import { IWorkbenchModeConfiguration, IWorkbenchModeService } from '../common/workbenchModeService.js';
import { ILogService } from '../../../../platform/log/common/log.js';
import { URI } from '../../../../base/common/uri.js';
import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
import { parse } from '../../../../base/common/json.js';
import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { Extensions, IConfigurationDefaults, IConfigurationRegistry } from '../../../../platform/configuration/common/configurationRegistry.js';
import { IStringDictionary } from '../../../../base/common/collections.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
export class WorkbenchModeService extends Disposable implements IWorkbenchModeService {
declare readonly _serviceBrand: undefined;
private static readonly WORKBENCH_MODE_STORAGE_KEY = 'workbench.mode';
private _workbenchMode: string | undefined;
get workbenchMode(): string | undefined { return this._workbenchMode; }
private readonly _onDidChangeWorkbenchMode = this._register(new Emitter<string | undefined>());
readonly onDidChangeWorkbenchMode: Event<string | undefined> = this._onDidChangeWorkbenchMode.event;
private readonly workbenchModeFileWatcherDiposables = this._register(new DisposableStore());
private readonly configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);
private configurationDefaults: IConfigurationDefaults | undefined;
constructor(
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IFileService private readonly fileService: IFileService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,
@ILogService private readonly logService: ILogService,
@IStorageService private readonly storageService: IStorageService
) {
super();
this._workbenchMode = this.workspaceContextService.getWorkspace().isAgentSessionsWorkspace
? 'agent-sessions'
: this.storageService.get(WorkbenchModeService.WORKBENCH_MODE_STORAGE_KEY, StorageScope.WORKSPACE);
this.watchCurrentModeFile();
}
async initialize(): Promise<void> {
return this.updateWorkbenchModeConfiguration();
}
private async updateWorkbenchModeConfiguration(): Promise<void> {
const workbenchModeConfiguration = this._workbenchMode ? await this.getWorkbenchModeConfiguration(this._workbenchMode) : undefined;
this.updateConfigurationDefaults(workbenchModeConfiguration?.settings);
}
private updateConfigurationDefaults(configurationDefaults: IStringDictionary<unknown> | undefined): void {
if (this.configurationDefaults) {
this.configurationRegistry.deregisterDefaultConfigurations([this.configurationDefaults]);
}
if (configurationDefaults) {
this.configurationDefaults = { overrides: configurationDefaults, donotCache: true };
this.configurationRegistry.registerDefaultConfigurations([this.configurationDefaults]);
} else {
this.configurationDefaults = undefined;
}
}
private watchCurrentModeFile(): void {
if (!this._workbenchMode) {
this.workbenchModeFileWatcherDiposables.clear();
return;
}
const workbenchModeFileUri = this.getWorkbenchModeFileUri(this._workbenchMode);
if (!workbenchModeFileUri) {
this.workbenchModeFileWatcherDiposables.clear();
return;
}
this.workbenchModeFileWatcherDiposables.add(this.fileService.watch(workbenchModeFileUri));
this.workbenchModeFileWatcherDiposables.add(this.fileService.onDidFilesChange(e => {
if (e.affects(workbenchModeFileUri)) {
this.updateWorkbenchModeConfiguration();
this._onDidChangeWorkbenchMode.fire(this._workbenchMode);
}
}));
}
private getWorkbenchModeFileUri(layoutId: string): URI {
return this.uriIdentityService.extUri.joinPath(this.environmentService.builtinWorkbenchModesHome, `${layoutId}.code-workbench-mode`);
}
async getWorkbenchModeConfiguration(id: string): Promise<IWorkbenchModeConfiguration | undefined> {
const resource = this.getWorkbenchModeFileUri(id);
return this.resolveWorkbenchModeConfiguration(resource);
}
async getWorkbenchModeConfigurations(): Promise<IWorkbenchModeConfiguration[]> {
const result: IWorkbenchModeConfiguration[] = [];
const workbenchModesFolder = this.environmentService.builtinWorkbenchModesHome;
try {
const stat = await this.fileService.resolve(workbenchModesFolder);
if (!stat.children?.length) {
return result;
}
for (const child of stat.children) {
if (child.isDirectory) {
continue;
}
const workbenchModeConfiguration = await this.resolveWorkbenchModeConfiguration(child.resource);
if (workbenchModeConfiguration) {
result.push(workbenchModeConfiguration);
}
}
} catch (error) {
this.logService.error(`Error while reading workbench mode files from ${workbenchModesFolder.toString()}`, error);
}
return result;
}
private async resolveWorkbenchModeConfiguration(workbenchConfigurationModeFile: URI): Promise<IWorkbenchModeConfiguration | undefined> {
if (this.uriIdentityService.extUri.extname(workbenchConfigurationModeFile) !== '.code-workbench-mode') {
return undefined;
}
try {
const content = (await this.fileService.readFile(workbenchConfigurationModeFile)).value.toString();
const name = this.uriIdentityService.extUri.basename(workbenchConfigurationModeFile);
const workbenchModeConfiguration: IWorkbenchModeConfiguration = {
id: name.substring(0, name.length - '.code-workbench-mode'.length),
...parse(content)
};
return workbenchModeConfiguration;
} catch (error) {
this.logService.error(`Error while reading workbench mode file from ${workbenchConfigurationModeFile.toString()}`, error);
return undefined;
}
}
async setWorkbenchMode(modeId: string | undefined): Promise<void> {
if (this.workspaceContextService.getWorkspace().isAgentSessionsWorkspace) {
throw new Error('Cannot set workbench mode in an agent sessions workspace');
}
if (this._workbenchMode === modeId) {
return;
}
this.updateWorkbenchMode(modeId);
await this.updateWorkbenchModeConfiguration();
this.watchCurrentModeFile();
this._onDidChangeWorkbenchMode.fire(modeId);
}
private updateWorkbenchMode(modeId: string | undefined): void {
this._workbenchMode = modeId;
if (modeId === undefined) {
this.storageService.remove(WorkbenchModeService.WORKBENCH_MODE_STORAGE_KEY, StorageScope.WORKSPACE);
} else {
this.storageService.store(WorkbenchModeService.WORKBENCH_MODE_STORAGE_KEY, modeId, StorageScope.WORKSPACE, StorageTarget.MACHINE);
}
}
}

View File

@@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from '../../../../base/common/event.js';
import { IStringDictionary } from '../../../../base/common/collections.js';
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
export const IWorkbenchModeService = createDecorator<IWorkbenchModeService>('workbenchModeService');
export interface IWorkbenchModeConfiguration {
readonly id: string;
readonly name: string;
readonly settings: IStringDictionary<unknown>;
}
export interface IWorkbenchModeService {
readonly _serviceBrand: undefined;
/**
* The currently active workbench mode id, or undefined if using default settings
*/
readonly workbenchMode: string | undefined;
/**
* Event fired when the workbench mode changes
*/
readonly onDidChangeWorkbenchMode: Event<string | undefined>;
/**
* Resolve a workbench mode by its id
* @param id The id of the workbench mode to resolve
*/
getWorkbenchModeConfiguration(id: string): Promise<IWorkbenchModeConfiguration | undefined>;
/**
* Get all workbench modes
*/
getWorkbenchModeConfigurations(): Promise<IWorkbenchModeConfiguration[]>;
/**
* Set the active workbench mode. Pass undefined to clear the mode and return to defaults.
*/
setWorkbenchMode(workbenchMode: string | undefined): Promise<void>;
}
export class DefaultWorkbenchModeService implements IWorkbenchModeService {
readonly _serviceBrand: undefined;
readonly workbenchMode: string | undefined = undefined;
readonly onDidChangeWorkbenchMode: Event<string | undefined> = Event.None;
getWorkbenchModeConfiguration(_id: string): Promise<IWorkbenchModeConfiguration | undefined> {
return Promise.resolve(undefined);
}
getWorkbenchModeConfigurations(): Promise<IWorkbenchModeConfiguration[]> {
return Promise.resolve([]);
}
setWorkbenchMode(_workbenchMode: string | undefined): Promise<void> {
return Promise.resolve();
}
}