mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
very first proposed API for multiple roots, #28526
This commit is contained in:
@@ -21,11 +21,11 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
|
||||
private static _requestIdPool = 0;
|
||||
|
||||
private readonly _onDidChangeWorkspace = new Emitter<this>();
|
||||
private readonly _onDidChangeWorkspace = new Emitter<URI[]>();
|
||||
private readonly _proxy: MainThreadWorkspaceShape;
|
||||
private _workspace: Workspace;
|
||||
|
||||
readonly onDidChangeWorkspace: Event<this> = this._onDidChangeWorkspace.event;
|
||||
readonly onDidChangeWorkspace: Event<URI[]> = this._onDidChangeWorkspace.event;
|
||||
|
||||
constructor(threadService: IThreadService, data: IWorkspaceData) {
|
||||
super();
|
||||
@@ -35,8 +35,12 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
|
||||
// --- workspace ---
|
||||
|
||||
get workspace(): Workspace {
|
||||
return this._workspace;
|
||||
getRoots(): URI[] {
|
||||
if (!this._workspace) {
|
||||
return undefined;
|
||||
} else {
|
||||
return this._workspace.roots.slice(0);
|
||||
}
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
@@ -85,7 +89,7 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
|
||||
$acceptWorkspaceData(data: IWorkspaceData): void {
|
||||
this._workspace = data ? new Workspace(data.id, data.name, data.roots) : null;
|
||||
this._onDidChangeWorkspace.fire(this);
|
||||
this._onDidChangeWorkspace.fire(this.getRoots());
|
||||
}
|
||||
|
||||
// --- search ---
|
||||
|
||||
Reference in New Issue
Block a user