Strict null check some legacy search files
parent
4326d05195
commit
c1f9ef9749
|
@ -769,6 +769,8 @@
|
|||
"./vs/workbench/services/scm/common/scmService.ts",
|
||||
"./vs/workbench/services/search/common/searchHelpers.ts",
|
||||
"./vs/workbench/services/search/node/fileSearch.ts",
|
||||
"./vs/workbench/services/search/node/legacy/rawLegacyTextSearchService.ts",
|
||||
"./vs/workbench/services/search/node/legacy/textSearch.ts",
|
||||
"./vs/workbench/services/search/node/fileSearchManager.ts",
|
||||
"./vs/workbench/services/search/node/legacy/search.ts",
|
||||
"./vs/workbench/services/search/node/legacy/textSearchWorkerProvider.ts",
|
||||
|
|
|
@ -52,7 +52,7 @@ export class LegacyTextSearchService {
|
|||
// Use BatchedCollector to get new results to the frontend every 2s at least, until 50 results have been returned
|
||||
const collector = new BatchedCollector<ISerializedFileMatch>(batchSize, progressCallback);
|
||||
engine.search((matches) => {
|
||||
const totalMatches = matches.reduce((acc, m) => acc + m.numMatches, 0);
|
||||
const totalMatches = matches.reduce((acc, m) => acc + m.numMatches!, 0);
|
||||
collector.addItems(matches, totalMatches);
|
||||
}, (progress) => {
|
||||
progressCallback(progress);
|
||||
|
|
|
@ -22,7 +22,7 @@ export interface IRawSearch {
|
|||
filePattern?: string;
|
||||
excludePattern?: glob.IExpression;
|
||||
includePattern?: glob.IExpression;
|
||||
contentPattern?: IPatternInfo;
|
||||
contentPattern: IPatternInfo;
|
||||
maxResults?: number;
|
||||
exists?: boolean;
|
||||
sortByScore?: boolean;
|
||||
|
|
|
@ -19,7 +19,7 @@ export class Engine implements ISearchEngine<ISerializedFileMatch[]> {
|
|||
private config: IRawSearch;
|
||||
private config2: ITextQuery;
|
||||
private walker: FileWalker;
|
||||
private walkerError: Error;
|
||||
private walkerError: Error | null;
|
||||
|
||||
private isCanceled = false;
|
||||
private isDone = false;
|
||||
|
@ -59,7 +59,7 @@ export class Engine implements ISearchEngine<ISerializedFileMatch[]> {
|
|||
});
|
||||
}
|
||||
|
||||
search(onResult: (match: ISerializedFileMatch[]) => void, onProgress: (progress: IProgress) => void, done: (error: Error, complete: ISearchEngineSuccess) => void): void {
|
||||
search(onResult: (match: ISerializedFileMatch[]) => void, onProgress: (progress: IProgress) => void, done: (error: Error | null, complete: ISearchEngineSuccess) => void): void {
|
||||
this.workers = this.workerProvider.getWorkers();
|
||||
this.initializeWorkers();
|
||||
|
||||
|
@ -177,10 +177,11 @@ export function makeRawSearch(query: ITextQuery): IRawSearch {
|
|||
includePattern: query.includePattern,
|
||||
maxResults: query.maxResults,
|
||||
useRipgrep: query.useRipgrep,
|
||||
disregardIgnoreFiles: query.folderQueries.some(fq => fq.disregardIgnoreFiles),
|
||||
disregardGlobalIgnoreFiles: query.folderQueries.some(fq => fq.disregardGlobalIgnoreFiles),
|
||||
ignoreSymlinks: query.folderQueries.some(fq => fq.ignoreSymlinks),
|
||||
previewOptions: query.previewOptions
|
||||
disregardIgnoreFiles: query.folderQueries.some(fq => fq.disregardIgnoreFiles!),
|
||||
disregardGlobalIgnoreFiles: query.folderQueries.some(fq => fq.disregardGlobalIgnoreFiles!),
|
||||
ignoreSymlinks: query.folderQueries.some(fq => fq.ignoreSymlinks!),
|
||||
previewOptions: query.previewOptions,
|
||||
contentPattern: query.contentPattern
|
||||
};
|
||||
|
||||
for (const q of query.folderQueries) {
|
||||
|
@ -196,11 +197,9 @@ export function makeRawSearch(query: ITextQuery): IRawSearch {
|
|||
|
||||
if (query.extraFileResources) {
|
||||
for (const r of query.extraFileResources) {
|
||||
rawSearch.extraFiles.push(r.fsPath);
|
||||
rawSearch.extraFiles!.push(r.fsPath);
|
||||
}
|
||||
}
|
||||
|
||||
rawSearch.contentPattern = query.contentPattern;
|
||||
|
||||
return rawSearch;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ export interface IRawFileMatch {
|
|||
}
|
||||
|
||||
export interface ISearchEngine<T> {
|
||||
search: (onResult: (matches: T) => void, onProgress: (progress: IProgress) => void, done: (error: Error, complete: ISearchEngineSuccess) => void) => void;
|
||||
search: (onResult: (matches: T) => void, onProgress: (progress: IProgress) => void, done: (error: Error | null, complete: ISearchEngineSuccess) => void) => void;
|
||||
cancel: () => void;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue