mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
move find-file logic into fsprovider, wire things up end to end
This commit is contained in:
@@ -278,11 +278,10 @@ export interface MainThreadWorkspaceShape extends IDisposable {
|
||||
$cancelSearch(requestId: number): Thenable<boolean>;
|
||||
$saveAll(includeUntitled?: boolean): Thenable<boolean>;
|
||||
$applyWorkspaceEdit(edits: IResourceEdit[]): TPromise<boolean>;
|
||||
$registerFileSystemProvider(handle: number, authority: string): void;
|
||||
$onFileSystemChange(handle: number, resource: URI): void;
|
||||
|
||||
$registerSearchProvider(handle: number, type: number): void;
|
||||
$unregisterSearchProvider(handle: number): void;
|
||||
$registerFileSystemProvider(handle: number, authority: string): void;
|
||||
$unregisterFileSystemProvider(handle): void;
|
||||
$onFileSystemChange(handle: number, resource: URI): void;
|
||||
$updateSearchSession(session: number, data): void;
|
||||
$finishSearchSession(session: number, err?: any): void;
|
||||
}
|
||||
@@ -426,7 +425,7 @@ export interface ExtHostWorkspaceShape {
|
||||
|
||||
$resolveFile(handle: number, resource: URI): TPromise<string>;
|
||||
$storeFile(handle: number, resource: URI, content: string): TPromise<any>;
|
||||
$startSearch(handle: number, session: number, query): void;
|
||||
$startSearch(handle: number, session: number, query: string): void;
|
||||
$cancelSearch(handle: number, session: number): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,6 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
|
||||
|
||||
private _handlePool = 0;
|
||||
private readonly _fsProvider = new Map<number, vscode.FileSystemProvider>();
|
||||
private readonly _searchProvider = new Map<number, vscode.SearchProvider>();
|
||||
private readonly _searchSession = new Map<number, CancellationTokenSource>();
|
||||
|
||||
registerFileSystemProvider(authority: string, provider: vscode.FileSystemProvider): vscode.Disposable {
|
||||
@@ -236,19 +235,13 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
|
||||
return asWinJsPromise(token => provider.writeContents(resource, content));
|
||||
}
|
||||
|
||||
registerSearchProvider(provider: vscode.SearchProvider): vscode.Disposable {
|
||||
const handle = ++this._handlePool;
|
||||
this._searchProvider.set(handle, provider);
|
||||
return new Disposable(() => this._fsProvider.delete(handle));
|
||||
}
|
||||
|
||||
$startSearch(handle: number, session: number, query): void {
|
||||
const provider = this._searchProvider.get(handle);
|
||||
$startSearch(handle: number, session: number, query: string): void {
|
||||
const provider = this._fsProvider.get(handle);
|
||||
const source = new CancellationTokenSource();
|
||||
const progress = new Progress<any>(chunk => this._proxy.$updateSearchSession(session, chunk));
|
||||
|
||||
this._searchSession.set(session, source);
|
||||
TPromise.wrap(provider.provideSearchResults(query, progress, source.token)).then(() => {
|
||||
TPromise.wrap(provider.findFiles(query, progress, source.token)).then(() => {
|
||||
this._proxy.$finishSearchSession(session);
|
||||
}, err => {
|
||||
this._proxy.$finishSearchSession(session, err);
|
||||
|
||||
Reference in New Issue
Block a user