mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
#28538 Take workspace as input in Configuration model
This commit is contained in:
@@ -83,7 +83,8 @@ export function createApiFactory(
|
||||
const extHostEditors = col.define(ExtHostContext.ExtHostEditors).set<ExtHostEditors>(new ExtHostEditors(threadService, extHostDocumentsAndEditors));
|
||||
const extHostCommands = col.define(ExtHostContext.ExtHostCommands).set<ExtHostCommands>(new ExtHostCommands(threadService, extHostHeapService));
|
||||
const extHostTreeViews = col.define(ExtHostContext.ExtHostTreeViews).set<ExtHostTreeViews>(new ExtHostTreeViews(threadService, extHostCommands));
|
||||
const extHostConfiguration = col.define(ExtHostContext.ExtHostConfiguration).set<ExtHostConfiguration>(new ExtHostConfiguration(threadService.get(MainContext.MainThreadConfiguration), initData.configuration));
|
||||
const extHostWorkspace = col.define(ExtHostContext.ExtHostWorkspace).set<ExtHostWorkspace>(new ExtHostWorkspace(threadService, initData.workspace));
|
||||
const extHostConfiguration = col.define(ExtHostContext.ExtHostConfiguration).set<ExtHostConfiguration>(new ExtHostConfiguration(threadService.get(MainContext.MainThreadConfiguration), initData.configuration, extHostWorkspace));
|
||||
const extHostDiagnostics = col.define(ExtHostContext.ExtHostDiagnostics).set<ExtHostDiagnostics>(new ExtHostDiagnostics(threadService));
|
||||
const languageFeatures = col.define(ExtHostContext.ExtHostLanguageFeatures).set<ExtHostLanguageFeatures>(new ExtHostLanguageFeatures(threadService, extHostDocuments, extHostCommands, extHostHeapService, extHostDiagnostics));
|
||||
const extHostFileSystemEvent = col.define(ExtHostContext.ExtHostFileSystemEventService).set<ExtHostFileSystemEventService>(new ExtHostFileSystemEventService());
|
||||
@@ -91,7 +92,6 @@ export function createApiFactory(
|
||||
const extHostTerminalService = col.define(ExtHostContext.ExtHostTerminalService).set<ExtHostTerminalService>(new ExtHostTerminalService(threadService));
|
||||
const extHostSCM = col.define(ExtHostContext.ExtHostSCM).set<ExtHostSCM>(new ExtHostSCM(threadService, extHostCommands));
|
||||
const extHostTask = col.define(ExtHostContext.ExtHostTask).set<ExtHostTask>(new ExtHostTask(threadService));
|
||||
const extHostWorkspace = col.define(ExtHostContext.ExtHostWorkspace).set<ExtHostWorkspace>(new ExtHostWorkspace(threadService, initData.workspace));
|
||||
col.define(ExtHostContext.ExtHostExtensionService).set(extensionService);
|
||||
col.finish(false, threadService);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { WorkspaceConfiguration } from 'vscode';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { ExtHostConfigurationShape, MainThreadConfigurationShape } from './extHost.protocol';
|
||||
import { IConfigurationData, Configuration } from 'vs/platform/configuration/common/configuration';
|
||||
import { ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
|
||||
@@ -29,7 +30,7 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
private _data: IConfigurationData<any>;
|
||||
private _configuration: Configuration<any>;
|
||||
|
||||
constructor(proxy: MainThreadConfigurationShape, data: IConfigurationData<any>) {
|
||||
constructor(proxy: MainThreadConfigurationShape, data: IConfigurationData<any>, private extWorkspace: ExtHostWorkspace) {
|
||||
super();
|
||||
this._proxy = proxy;
|
||||
this._data = data;
|
||||
@@ -47,7 +48,7 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
|
||||
private get configuration(): Configuration<any> {
|
||||
if (!this._configuration) {
|
||||
this._configuration = Configuration.parse(this._data);
|
||||
this._configuration = Configuration.parse(this._data, this.extWorkspace.workspace);
|
||||
}
|
||||
return this._configuration;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import { relative } from 'path';
|
||||
import { Workspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
|
||||
import { IResourceEdit } from 'vs/editor/common/services/bulkEdit';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
@@ -22,18 +23,22 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
|
||||
private readonly _onDidChangeWorkspace = new Emitter<this>();
|
||||
private readonly _proxy: MainThreadWorkspaceShape;
|
||||
private _workspace: IWorkspaceData;
|
||||
private _workspace: Workspace;
|
||||
|
||||
readonly onDidChangeWorkspace: Event<this> = this._onDidChangeWorkspace.event;
|
||||
|
||||
constructor(threadService: IThreadService, workspace: IWorkspaceData) {
|
||||
constructor(threadService: IThreadService, data: IWorkspaceData) {
|
||||
super();
|
||||
this._proxy = threadService.get(MainContext.MainThreadWorkspace);
|
||||
this._workspace = workspace;
|
||||
this._workspace = data ? new Workspace(data.id, data.name, data.roots) : null;
|
||||
}
|
||||
|
||||
// --- workspace ---
|
||||
|
||||
get workspace(): Workspace {
|
||||
return this._workspace;
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
// this is legacy from the days before having
|
||||
// multi-root and we keep it only alive if there
|
||||
@@ -69,8 +74,8 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
return normalize(path);
|
||||
}
|
||||
|
||||
$acceptWorkspaceData(workspace: IWorkspaceData): void {
|
||||
this._workspace = workspace;
|
||||
$acceptWorkspaceData(data: IWorkspaceData): void {
|
||||
this._workspace = data ? new Workspace(data.id, data.name, data.roots) : null;
|
||||
this._onDidChangeWorkspace.fire(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user