remove getConfiguration() from workspace service
This commit is contained in:
parent
ffd210a7a5
commit
d1491f4ac5
|
@ -18,11 +18,6 @@ export interface IWorkspaceContextService {
|
|||
*/
|
||||
getWorkspace(): IWorkspace;
|
||||
|
||||
/**
|
||||
* Provides access to the configuration object the platform is running with.
|
||||
*/
|
||||
getConfiguration(): IConfiguration;
|
||||
|
||||
/**
|
||||
* Provides access to the options object the platform is running with.
|
||||
*/
|
||||
|
@ -76,20 +71,3 @@ export interface IWorkspace {
|
|||
*/
|
||||
uid?: number;
|
||||
}
|
||||
|
||||
export interface IConfiguration {
|
||||
/**
|
||||
* Some environmental flags
|
||||
*/
|
||||
env?: IEnvironment;
|
||||
}
|
||||
|
||||
export interface IEnvironment {
|
||||
appRoot: string;
|
||||
|
||||
extensionDevelopmentPath: string;
|
||||
extensionTestsPath: string;
|
||||
|
||||
recentFiles: string[];
|
||||
recentFolders: string[];
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import paths = require('vs/base/common/paths');
|
||||
import {IWorkspaceContextService, IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace';
|
||||
import {IWorkspaceContextService, IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||
|
||||
/**
|
||||
* Simple IWorkspaceContextService implementation to allow sharing of this service implementation
|
||||
|
@ -19,11 +19,9 @@ export class BaseWorkspaceContextService implements IWorkspaceContextService {
|
|||
protected options: any;
|
||||
|
||||
private workspace: IWorkspace;
|
||||
private configuration: IConfiguration;
|
||||
|
||||
constructor(workspace: IWorkspace, configuration?: IConfiguration, options: any = {}) {
|
||||
constructor(workspace: IWorkspace, options: any = {}) {
|
||||
this.workspace = workspace;
|
||||
this.configuration = configuration;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
|
@ -31,10 +29,6 @@ export class BaseWorkspaceContextService implements IWorkspaceContextService {
|
|||
return this.workspace;
|
||||
}
|
||||
|
||||
public getConfiguration(): IConfiguration {
|
||||
return this.configuration;
|
||||
}
|
||||
|
||||
public getOptions(): any {
|
||||
return this.options;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import {IEditorInput, IEditorModel, Position, Direction, IEditor, IResourceInput
|
|||
import {IEventService} from 'vs/platform/event/common/event';
|
||||
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import {IMessageService, IConfirmation} from 'vs/platform/message/common/message';
|
||||
import {IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace';
|
||||
import {IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||
import {ILifecycleService, ShutdownEvent} from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel';
|
||||
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
||||
|
@ -51,22 +51,16 @@ export const TestWorkspace: IWorkspace = {
|
|||
mtime: new Date().getTime()
|
||||
};
|
||||
|
||||
export const TestConfiguration: IConfiguration = {
|
||||
env: Object.create(null)
|
||||
};
|
||||
|
||||
export const TestEnvironmentService = new EnvironmentService(Objects.assign(parseArgs(process.argv), { execPath: process.execPath }));
|
||||
|
||||
export class TestContextService implements WorkspaceContextService.IWorkspaceContextService {
|
||||
public _serviceBrand: any;
|
||||
|
||||
private workspace: any;
|
||||
private configuration: any;
|
||||
private options: any;
|
||||
|
||||
constructor(workspace: any = TestWorkspace, configuration: any = TestConfiguration, options: any = null) {
|
||||
constructor(workspace: any = TestWorkspace, options: any = null) {
|
||||
this.workspace = workspace;
|
||||
this.configuration = configuration;
|
||||
this.options = options || {
|
||||
globalSettings: {
|
||||
settings: {}
|
||||
|
@ -78,10 +72,6 @@ export class TestContextService implements WorkspaceContextService.IWorkspaceCon
|
|||
return this.workspace;
|
||||
}
|
||||
|
||||
public getConfiguration(): IConfiguration {
|
||||
return this.configuration;
|
||||
}
|
||||
|
||||
public getOptions() {
|
||||
return this.options;
|
||||
}
|
||||
|
|
|
@ -55,11 +55,6 @@ export interface IConfiguration extends IEnvironment {
|
|||
|
||||
export function startup(configuration: IConfiguration, globalSettings: IGlobalSettings): winjs.TPromise<void> {
|
||||
|
||||
// Shell Configuration
|
||||
const shellConfiguration: any = {
|
||||
env: configuration
|
||||
};
|
||||
|
||||
// Shell Options
|
||||
const filesToOpen = configuration.filesToOpen && configuration.filesToOpen.length ? toInputs(configuration.filesToOpen) : null;
|
||||
const filesToCreate = configuration.filesToCreate && configuration.filesToCreate.length ? toInputs(configuration.filesToCreate) : null;
|
||||
|
@ -78,7 +73,7 @@ export function startup(configuration: IConfiguration, globalSettings: IGlobalSe
|
|||
}
|
||||
|
||||
// Open workbench
|
||||
return openWorkbench(configuration, getWorkspace(configuration.workspacePath), shellConfiguration, shellOptions);
|
||||
return openWorkbench(configuration, getWorkspace(configuration.workspacePath), shellOptions);
|
||||
}
|
||||
|
||||
function toInputs(paths: IPath[]): IResourceInput[] {
|
||||
|
@ -127,10 +122,10 @@ function getWorkspace(workspacePath: string): IWorkspace {
|
|||
};
|
||||
}
|
||||
|
||||
function openWorkbench(environment: IEnvironment, workspace: IWorkspace, configuration: IConfiguration, options: IOptions): winjs.TPromise<void> {
|
||||
function openWorkbench(environment: IEnvironment, workspace: IWorkspace, options: IOptions): winjs.TPromise<void> {
|
||||
const eventService = new EventService();
|
||||
const environmentService = new EnvironmentService(environment);
|
||||
const contextService = new WorkspaceContextService(eventService, workspace, configuration, options);
|
||||
const contextService = new WorkspaceContextService(eventService, workspace, options);
|
||||
const configurationService = new ConfigurationService(contextService, eventService, environmentService);
|
||||
|
||||
// Since the configuration service is one of the core services that is used in so many places, we initialize it
|
||||
|
@ -148,7 +143,7 @@ function openWorkbench(environment: IEnvironment, workspace: IWorkspace, configu
|
|||
eventService,
|
||||
contextService,
|
||||
environmentService
|
||||
}, configuration, options);
|
||||
}, options);
|
||||
shell.open();
|
||||
|
||||
shell.joinCreation().then(() => {
|
||||
|
|
|
@ -64,7 +64,7 @@ import {ISearchService} from 'vs/platform/search/common/search';
|
|||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||
import {ICommandService} from 'vs/platform/commands/common/commands';
|
||||
import {CommandService} from 'vs/platform/commands/common/commandService';
|
||||
import {IWorkspaceContextService, IConfiguration, IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||
import {IWorkspaceContextService, IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
|
||||
import {MainThreadModeServiceImpl} from 'vs/editor/common/services/modeServiceImpl';
|
||||
import {IModeService} from 'vs/editor/common/services/modeService';
|
||||
|
@ -119,16 +119,14 @@ export class WorkbenchShell {
|
|||
private content: HTMLElement;
|
||||
private contentsContainer: Builder;
|
||||
|
||||
private configuration: IConfiguration;
|
||||
private workspace: IWorkspace;
|
||||
private options: IOptions;
|
||||
private workbench: Workbench;
|
||||
|
||||
constructor(container: HTMLElement, workspace: IWorkspace, services: ICoreServices, configuration: IConfiguration, options: IOptions) {
|
||||
constructor(container: HTMLElement, workspace: IWorkspace, services: ICoreServices, options: IOptions) {
|
||||
this.container = container;
|
||||
|
||||
this.workspace = workspace;
|
||||
this.configuration = configuration;
|
||||
this.options = options;
|
||||
|
||||
this.contextService = services.contextService;
|
||||
|
@ -158,7 +156,7 @@ export class WorkbenchShell {
|
|||
}
|
||||
|
||||
// Workbench
|
||||
this.workbench = instantiationService.createInstance(Workbench, workbenchContainer.getHTMLElement(), this.workspace, this.configuration, this.options, serviceCollection);
|
||||
this.workbench = instantiationService.createInstance(Workbench, workbenchContainer.getHTMLElement(), this.workspace, this.options, serviceCollection);
|
||||
this.workbench.startup({
|
||||
onWorkbenchStarted: (customKeybindingsCount) => {
|
||||
this.onWorkbenchStarted(customKeybindingsCount);
|
||||
|
@ -239,7 +237,7 @@ export class WorkbenchShell {
|
|||
serviceCollection.set(IWindowService, this.windowService);
|
||||
|
||||
// Storage
|
||||
const disableWorkspaceStorage = this.configuration.env.extensionTestsPath || (!this.workspace && !this.environmentService.extensionDevelopmentPath); // without workspace or in any extension test, we use inMemory storage unless we develop an extension where we want to preserve state
|
||||
const disableWorkspaceStorage = this.environmentService.extensionTestsPath || (!this.workspace && !this.environmentService.extensionDevelopmentPath); // without workspace or in any extension test, we use inMemory storage unless we develop an extension where we want to preserve state
|
||||
this.storageService = instantiationService.createInstance(Storage, window.localStorage, disableWorkspaceStorage ? inMemoryLocalStorageInstance : window.localStorage);
|
||||
serviceCollection.set(IStorageService, this.storageService);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage'
|
|||
import {ContextMenuService} from 'vs/workbench/services/contextview/electron-browser/contextmenuService';
|
||||
import {WorkbenchKeybindingService} from 'vs/workbench/services/keybinding/electron-browser/keybindingService';
|
||||
import {ContextKeyService} from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import {IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace';
|
||||
import {IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
|
||||
import {ContextKeyExpr, RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||
import {IActivityService} from 'vs/workbench/services/activity/common/activityService';
|
||||
|
@ -76,7 +76,6 @@ export const NoEditorsVisibleContext:ContextKeyExpr = EditorsVisibleContext.toNe
|
|||
|
||||
interface WorkbenchParams {
|
||||
workspace?: IWorkspace;
|
||||
configuration: IConfiguration;
|
||||
options: IOptions;
|
||||
serviceCollection: ServiceCollection;
|
||||
}
|
||||
|
@ -131,7 +130,6 @@ export class Workbench implements IPartService {
|
|||
constructor(
|
||||
container: HTMLElement,
|
||||
workspace: IWorkspace,
|
||||
configuration: IConfiguration,
|
||||
options: IOptions,
|
||||
serviceCollection: ServiceCollection,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
|
@ -146,7 +144,7 @@ export class Workbench implements IPartService {
|
|||
) {
|
||||
|
||||
// Validate params
|
||||
this.validateParams(container, configuration, options);
|
||||
this.validateParams(container, options);
|
||||
|
||||
// If String passed in as container, try to find it in DOM
|
||||
if (types.isString(container)) {
|
||||
|
@ -161,7 +159,6 @@ export class Workbench implements IPartService {
|
|||
|
||||
this.workbenchParams = {
|
||||
workspace: workspace,
|
||||
configuration: configuration,
|
||||
options: options || {},
|
||||
serviceCollection
|
||||
};
|
||||
|
@ -175,7 +172,7 @@ export class Workbench implements IPartService {
|
|||
});
|
||||
}
|
||||
|
||||
private validateParams(container: HTMLElement, configuration: IConfiguration, options: IOptions): void {
|
||||
private validateParams(container: HTMLElement, options: IOptions): void {
|
||||
|
||||
// Container
|
||||
assert.ok(container, 'Workbench requires a container to be created with');
|
||||
|
|
|
@ -44,7 +44,6 @@ export interface IInitData {
|
|||
threadService: any;
|
||||
contextService: {
|
||||
workspace: any;
|
||||
configuration: any;
|
||||
options: any;
|
||||
};
|
||||
}
|
||||
|
@ -74,7 +73,7 @@ export class ExtensionHostMain {
|
|||
|
||||
this._environment = initData.environment;
|
||||
|
||||
this._contextService = new BaseWorkspaceContextService(initData.contextService.workspace, initData.contextService.configuration, initData.contextService.options);
|
||||
this._contextService = new BaseWorkspaceContextService(initData.contextService.workspace, initData.contextService.options);
|
||||
const workspaceStoragePath = this._getOrCreateWorkspaceStoragePath();
|
||||
|
||||
const threadService = new ExtHostThreadService(remoteCom);
|
||||
|
|
|
@ -177,7 +177,6 @@ class ExtensionHostProcessManager {
|
|||
},
|
||||
contextService: {
|
||||
workspace: this.contextService.getWorkspace(),
|
||||
configuration: this.contextService.getConfiguration(),
|
||||
options: this.contextService.getOptions()
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ import {IOptions} from 'vs/workbench/common/options';
|
|||
import {EventType, OptionsChangeEvent} from 'vs/workbench/common/events';
|
||||
import {IEventService} from 'vs/platform/event/common/event';
|
||||
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
|
||||
import {IWorkspace, IConfiguration, IWorkspaceContextService as IBaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
||||
import {IWorkspace, IWorkspaceContextService as IBaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
||||
import {BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspaceContextService';
|
||||
|
||||
export const IWorkspaceContextService = createDecorator<IWorkspaceContextService>('contextService');
|
||||
|
@ -33,10 +33,9 @@ export class WorkspaceContextService extends BaseWorkspaceContextService impleme
|
|||
constructor(
|
||||
private eventService: IEventService,
|
||||
workspace: IWorkspace,
|
||||
configuration?: IConfiguration,
|
||||
options: any = {}
|
||||
) {
|
||||
super(workspace, configuration, options);
|
||||
super(workspace, options);
|
||||
}
|
||||
|
||||
public updateOptions(key: string, value: any): void {
|
||||
|
|
|
@ -105,7 +105,7 @@ suite('Workbench Part', () => {
|
|||
fixture = document.createElement('div');
|
||||
fixture.id = fixtureId;
|
||||
document.body.appendChild(fixture);
|
||||
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, TestUtils.TestConfiguration, null);
|
||||
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, null);
|
||||
storage = new Storage(new InMemoryLocalStorage(), null, context);
|
||||
});
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import {QuickOpenHandler, IQuickOpenRegistry, Extensions} from 'vs/workbench/bro
|
|||
import {Registry} from 'vs/platform/platform';
|
||||
import {SearchService} from 'vs/workbench/services/search/node/searchService';
|
||||
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import {TestEnvironmentService, TestConfiguration, TestEditorService, TestEditorGroupService} from 'vs/test/utils/servicesTestUtils';
|
||||
import {TestEnvironmentService, TestEditorService, TestEditorGroupService} from 'vs/test/utils/servicesTestUtils';
|
||||
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
|
||||
import * as Timer from 'vs/base/common/timer';
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
|
@ -50,7 +50,7 @@ suite('QuickOpen performance', () => {
|
|||
name: null,
|
||||
uid: null,
|
||||
mtime: null
|
||||
}, TestConfiguration),
|
||||
}),
|
||||
|
||||
telemetryService
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as assert from 'assert';
|
|||
import {EditorStacksModel, EditorGroup} from 'vs/workbench/common/editor/editorStacksModel';
|
||||
import {EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorRegistry, Extensions as EditorExtensions, IEditorInputFactory} from 'vs/workbench/common/editor';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import {TestStorageService, TestConfigurationService, TestLifecycleService, TestContextService, TestWorkspace, TestConfiguration} from 'vs/test/utils/servicesTestUtils';
|
||||
import {TestStorageService, TestConfigurationService, TestLifecycleService, TestContextService, TestWorkspace} from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestInstantiationService } from 'vs/test/utils/instantiationTestUtils';
|
||||
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
||||
import {IStorageService} from 'vs/platform/storage/common/storage';
|
||||
|
@ -1384,7 +1384,7 @@ suite('Editor Stacks Model', () => {
|
|||
let inst = new TestInstantiationService();
|
||||
|
||||
inst.stub(IStorageService, new TestStorageService());
|
||||
inst.stub(IWorkspaceContextService, new TestContextService(TestWorkspace, TestConfiguration, { filesToCreate: [true] }));
|
||||
inst.stub(IWorkspaceContextService, new TestContextService(TestWorkspace, { filesToCreate: [true] }));
|
||||
const lifecycle = new TestLifecycleService();
|
||||
inst.stub(ILifecycleService, lifecycle);
|
||||
const config = new TestConfigurationService();
|
||||
|
|
|
@ -17,7 +17,7 @@ suite('Workbench Memento', () => {
|
|||
let storage;
|
||||
|
||||
setup(() => {
|
||||
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, TestUtils.TestConfiguration, null);
|
||||
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, null);
|
||||
storage = new Storage(new InMemoryLocalStorage(), null, context);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue