mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
add $acceptWorkspaceData to push new info about open folders, #28526
This commit is contained in:
@@ -91,6 +91,7 @@ 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 && [initData.workspace.resource]));
|
||||
col.define(ExtHostContext.ExtHostExtensionService).set(extensionService);
|
||||
col.finish(false, threadService);
|
||||
|
||||
@@ -99,8 +100,6 @@ export function createApiFactory(
|
||||
const extHostStatusBar = new ExtHostStatusBar(threadService);
|
||||
const extHostProgress = new ExtHostProgress(threadService.get(MainContext.MainThreadProgress));
|
||||
const extHostOutputService = new ExtHostOutputService(threadService);
|
||||
const workspacePath = initData.workspace ? initData.workspace.resource.fsPath : undefined;
|
||||
const extHostWorkspace = new ExtHostWorkspace(threadService, workspacePath);
|
||||
const extHostLanguages = new ExtHostLanguages(threadService);
|
||||
|
||||
// Register API-ish commands
|
||||
|
||||
@@ -404,6 +404,10 @@ export abstract class ExtHostTreeViewsShape {
|
||||
$getChildren(treeViewId: string, treeItemHandle: number): TPromise<ITreeItem[]> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class ExtHostWorkspaceShape {
|
||||
$acceptWorkspaceData(folders: URI[]): void { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class ExtHostExtensionServiceShape {
|
||||
$activateExtension(extensionDescription: IExtensionDescription): TPromise<void> { throw ni(); }
|
||||
}
|
||||
@@ -524,5 +528,6 @@ export const ExtHostContext = {
|
||||
ExtHostExtensionService: createExtId<ExtHostExtensionServiceShape>('ExtHostExtensionService', ExtHostExtensionServiceShape),
|
||||
ExtHostTerminalService: createExtId<ExtHostTerminalServiceShape>('ExtHostTerminalService', ExtHostTerminalServiceShape),
|
||||
ExtHostSCM: createExtId<ExtHostSCMShape>('ExtHostSCM', ExtHostSCMShape),
|
||||
ExtHostTask: createExtId<ExtHostTaskShape>('ExtHostTask', ExtHostTaskShape)
|
||||
ExtHostTask: createExtId<ExtHostTaskShape>('ExtHostTask', ExtHostTaskShape),
|
||||
ExtHostWorkspace: createExtId<ExtHostWorkspaceShape>('ExtHostWorkspace', ExtHostWorkspaceShape),
|
||||
};
|
||||
|
||||
@@ -6,26 +6,30 @@
|
||||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import { relative } from 'path';
|
||||
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';
|
||||
import { fromRange, EndOfLine } from 'vs/workbench/api/node/extHostTypeConverters';
|
||||
import { MainContext, MainThreadWorkspaceShape } from './extHost.protocol';
|
||||
import { ExtHostWorkspaceShape, MainContext, MainThreadWorkspaceShape } from './extHost.protocol';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class ExtHostWorkspace {
|
||||
export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
|
||||
private static _requestIdPool = 0;
|
||||
|
||||
private _proxy: MainThreadWorkspaceShape;
|
||||
private _workspacePath: string;
|
||||
|
||||
constructor(threadService: IThreadService, workspacePath: string) {
|
||||
constructor(threadService: IThreadService, folders: URI[]) {
|
||||
super();
|
||||
this._proxy = threadService.get(MainContext.MainThreadWorkspace);
|
||||
this._workspacePath = workspacePath;
|
||||
this._workspacePath = isFalsyOrEmpty(folders) ? undefined : folders[0].fsPath;
|
||||
}
|
||||
|
||||
// --- workspace ---
|
||||
|
||||
getPath(): string {
|
||||
return this._workspacePath;
|
||||
}
|
||||
@@ -55,6 +59,12 @@ export class ExtHostWorkspace {
|
||||
return normalize(result);
|
||||
}
|
||||
|
||||
$acceptWorkspaceData(folders: URI[]): void {
|
||||
// todo@joh do something, align with ctor URI[] vs IWorkspace
|
||||
}
|
||||
|
||||
// --- search ---
|
||||
|
||||
findFiles(include: string, exclude: string, maxResults?: number, token?: vscode.CancellationToken): Thenable<vscode.Uri[]> {
|
||||
const requestId = ExtHostWorkspace._requestIdPool++;
|
||||
const result = this._proxy.$startSearch(include, exclude, maxResults, requestId);
|
||||
|
||||
Reference in New Issue
Block a user