提交 6bf9cc1e 编写于 作者: M Matt Bierner

Fixing more strict null errors

For #81574
上级 5d7dac35
......@@ -213,7 +213,7 @@ export class FileWalker {
onMessage({ message: rgCmd });
this.cmdResultCount = 0;
this.collectStdout(cmd, 'utf8', onMessage, (err: Error, stdout?: string, last?: boolean) => {
this.collectStdout(cmd, 'utf8', onMessage, (err: Error | null, stdout?: string, last?: boolean) => {
if (err) {
done(err);
return;
......@@ -300,7 +300,7 @@ export class FileWalker {
*/
readStdout(cmd: childProcess.ChildProcess, encoding: string, cb: (err: Error | null, stdout?: string) => void): void {
let all = '';
this.collectStdout(cmd, encoding, () => { }, (err: Error, stdout?: string, last?: boolean) => {
this.collectStdout(cmd, encoding, () => { }, (err: Error | null, stdout?: string, last?: boolean) => {
if (err) {
cb(err);
return;
......@@ -547,12 +547,9 @@ export class FileWalker {
return clb(null, undefined);
});
});
}, (error: Error[]): void => {
if (error) {
error = arrays.coalesce(error); // find any error by removing null values first
}
return done(error && error.length > 0 ? error[0] : undefined);
}, (error: Array<Error | null> | null): void => {
const filteredErrors = error ? arrays.coalesce(error) : error; // find any error by removing null values first
return done(filteredErrors && filteredErrors.length > 0 ? filteredErrors[0] : undefined);
});
}
......@@ -622,8 +619,8 @@ export class Engine implements ISearchEngine<IRawFileMatch> {
this.walker = new FileWalker(config);
}
search(onResult: (result: IRawFileMatch) => void, onProgress: (progress: IProgressMessage) => void, done: (error: Error, complete: ISearchEngineSuccess) => void): void {
this.walker.walk(this.folderQueries, this.extraFiles, onResult, onProgress, (err: Error, isLimitHit: boolean) => {
search(onResult: (result: IRawFileMatch) => void, onProgress: (progress: IProgressMessage) => void, done: (error: Error | null, complete: ISearchEngineSuccess) => void): void {
this.walker.walk(this.folderQueries, this.extraFiles, onResult, onProgress, (err: Error | null, isLimitHit: boolean) => {
done(err, {
limitHit: isLimitHit,
stats: this.walker.getStats()
......
......@@ -12,6 +12,7 @@ import { IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers'
import { mock } from 'vs/workbench/test/browser/api/mock';
import { Emitter, Event } from 'vs/base/common/event';
import { NullLogService } from 'vs/platform/log/common/log';
import type * as vscode from 'vscode';
suite('ExtHostDiagnostics', () => {
......@@ -96,7 +97,7 @@ suite('ExtHostDiagnostics', () => {
assert.throws(() => array.pop());
assert.throws(() => array[0] = new Diagnostic(new Range(0, 0, 0, 0), 'evil'));
collection.forEach((uri, array: readonly Diagnostic[]) => {
collection.forEach((uri: URI, array: readonly vscode.Diagnostic[]): any => {
assert.throws(() => (array as Diagnostic[]).length = 0);
assert.throws(() => (array as Diagnostic[]).pop());
assert.throws(() => (array as Diagnostic[])[0] = new Diagnostic(new Range(0, 0, 0, 0), 'evil'));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册