mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
Strict null check extHostSearch.ts
This commit is contained in:
@@ -124,6 +124,10 @@ export class ExtHostSearch implements ExtHostSearchShape {
|
||||
}, token);
|
||||
} else {
|
||||
const indexProvider = this._fileIndexProvider.get(handle);
|
||||
if (!indexProvider) {
|
||||
throw new Error('unknown provider: ' + handle);
|
||||
}
|
||||
|
||||
return this._fileIndexSearchManager.fileSearch(query, indexProvider, batch => {
|
||||
this._proxy.$handleFileMatch(handle, session, batch.map(p => p.resource));
|
||||
}, token);
|
||||
@@ -147,7 +151,11 @@ export class ExtHostSearch implements ExtHostSearchShape {
|
||||
}
|
||||
};
|
||||
|
||||
return this._internalFileSearchProvider.doFileSearch(rawQuery, onResult, token);
|
||||
if (!this._internalFileSearchProvider) {
|
||||
throw new Error('No internal file search handler');
|
||||
}
|
||||
|
||||
return <Promise<ISearchCompleteStats>>this._internalFileSearchProvider.doFileSearch(rawQuery, onResult, token);
|
||||
}
|
||||
|
||||
$clearCache(cacheKey: string): Promise<void> {
|
||||
@@ -163,8 +171,8 @@ export class ExtHostSearch implements ExtHostSearchShape {
|
||||
|
||||
$provideTextSearchResults(handle: number, session: number, rawQuery: IRawTextQuery, token: CancellationToken): Promise<ISearchCompleteStats> {
|
||||
const provider = this._textSearchProvider.get(handle);
|
||||
if (!provider.provideTextSearchResults) {
|
||||
return Promise.resolve(undefined);
|
||||
if (!provider || !provider.provideTextSearchResults) {
|
||||
throw new Error(`Unknown provider ${handle}`);
|
||||
}
|
||||
|
||||
const query = reviveQuery(rawQuery);
|
||||
|
||||
Reference in New Issue
Block a user