提交 435ca5fe 编写于 作者: S Sandeep Somavarapu

#28538 Remove passing roots from roots change event

上级 2ea7f1c6
......@@ -523,8 +523,8 @@ export class SimpleWorkspaceContextService implements IWorkspaceContextService {
private static SCHEME: 'inmemory';
private readonly _onDidChangeWorkspaceRoots: Emitter<URI[]> = new Emitter<URI[]>();
public readonly onDidChangeWorkspaceRoots: Event<URI[]> = this._onDidChangeWorkspaceRoots.event;
private readonly _onDidChangeWorkspaceRoots: Emitter<void> = new Emitter<void>();
public readonly onDidChangeWorkspaceRoots: Event<void> = this._onDidChangeWorkspaceRoots.event;
private readonly legacyWorkspace: ILegacyWorkspace;
private readonly workspace: IWorkspace;
......
......@@ -36,7 +36,7 @@ export interface IWorkspaceContextService {
/**
* An event which fires on workspace roots change.
*/
onDidChangeWorkspaceRoots: Event<URI[]>;
onDidChangeWorkspaceRoots: Event<void>;
/**
* Returns the root for the given resource from the workspace.
......
......@@ -163,8 +163,8 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
public _serviceBrand: any;
private readonly _onDidChangeWorkspaceRoots: Emitter<URI[]> = this._register(new Emitter<URI[]>());
public readonly onDidChangeWorkspaceRoots: Event<URI[]> = this._onDidChangeWorkspaceRoots.event;
private readonly _onDidChangeWorkspaceRoots: Emitter<void> = this._register(new Emitter<void>());
public readonly onDidChangeWorkspaceRoots: Event<void> = this._onDidChangeWorkspaceRoots.event;
private readonly _onDidUpdateConfiguration: Emitter<IConfigurationServiceEvent> = this._register(new Emitter<IConfigurationServiceEvent>());
public readonly onDidUpdateConfiguration: Event<IConfigurationServiceEvent> = this._onDidUpdateConfiguration.event;
......@@ -222,7 +222,7 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
this.workspace.roots = configuredFolders;
this.workspace.name = configuredFolders.map(root => basename(root.fsPath) || root.fsPath).join(', ');
this._onDidChangeWorkspaceRoots.fire(configuredFolders);
this._onDidChangeWorkspaceRoots.fire();
}
}
......@@ -372,7 +372,10 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
}
}
private trigger(source: ConfigurationSource, sourceConfig: any = this._configuration.getFolderConfigurationModel(this.workspace.roots[0]).contents): void {
private trigger(source: ConfigurationSource, sourceConfig?: any): void {
if (!sourceConfig) {
sourceConfig = this.workspace ? this._configuration.getFolderConfigurationModel(this.workspace.roots[0]).contents : this._configuration.user.contents;
}
this._onDidUpdateConfiguration.fire({ source, sourceConfig });
}
}
......
......@@ -73,7 +73,8 @@ export class FileWatcher {
}
}, this.errorLogger);
this.contextService.onDidChangeWorkspaceRoots(roots => {
this.contextService.onDidChangeWorkspaceRoots(() => {
const roots = this.contextService.getWorkspace2().roots;
service.setRoots(roots.map(r => r.fsPath));
console.log('roots changed', roots);
});
......
......@@ -68,16 +68,16 @@ export class TestContextService implements IWorkspaceContextService {
private id: string;
private options: any;
private _onDidChangeWorkspaceRoots: Emitter<URI[]>;
private _onDidChangeWorkspaceRoots: Emitter<void>;
constructor(workspace: any = TestWorkspace, options: any = null) {
this.workspace = workspace;
this.id = generateUuid();
this.options = options || Object.create(null);
this._onDidChangeWorkspaceRoots = new Emitter<URI[]>();
this._onDidChangeWorkspaceRoots = new Emitter<void>();
}
public get onDidChangeWorkspaceRoots(): Event<URI[]> {
public get onDidChangeWorkspaceRoots(): Event<void> {
return this._onDidChangeWorkspaceRoots.event;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册