提交 235a5719 编写于 作者: B Benjamin Pasero

address some strict function type errors (#81574)

上级 fb98d230
......@@ -42,7 +42,7 @@ suite('Files', () => {
assert.strictEqual(true, r1.gotDeleted());
});
function testIsEqual(testMethod: (pA: string | undefined, pB: string, ignoreCase: boolean) => boolean): void {
function testIsEqual(testMethod: (pA: string, pB: string, ignoreCase: boolean) => boolean): void {
// corner cases
assert(testMethod('', '', true));
......@@ -136,7 +136,7 @@ suite('Files', () => {
test('isEqualOrParent (ignorecase)', function () {
// same assertions apply as with isEqual()
testIsEqual(isEqualOrParent);
testIsEqual(isEqualOrParent); //
if (isWindows) {
assert(isEqualOrParent('c:\\some\\path', 'c:\\', true));
......@@ -182,4 +182,4 @@ suite('Files', () => {
assert(!isEqualOrParent('foo/bar/test.ts', 'foo/BAR/test.', true));
}
});
});
\ No newline at end of file
});
......@@ -477,14 +477,13 @@ export class EditorGroup extends Disposable {
private splice(index: number, del: boolean, editor?: EditorInput): void {
const editorToDeleteOrReplace = this.editors[index];
const args: (number | EditorInput)[] = [index, del ? 1 : 0];
// Perform on editors array
if (editor) {
args.push(editor);
this.editors.splice(index, del ? 1 : 0, editor);
} else {
this.editors.splice(index, del ? 1 : 0);
}
// Perform on editors array
this.editors.splice.apply(this.editors, args);
// Add
if (!del && editor) {
this.mru.push(editor); // make it LRU editor
......
......@@ -7,7 +7,7 @@ import * as assert from 'assert';
import { IEditorModel, EditorActivation } from 'vs/platform/editor/common/editor';
import { URI } from 'vs/base/common/uri';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { EditorInput, EditorOptions, IFileEditorInput, IEditorInput, GroupIdentifier, ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor';
import { EditorInput, EditorOptions, IFileEditorInput, GroupIdentifier, ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor';
import { workbenchInstantiationService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
......@@ -354,7 +354,7 @@ suite('EditorService', () => {
const inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.parse('my://resource-delegate'), undefined);
const delegate = instantiationService.createInstance(DelegatingEditorService);
delegate.setEditorOpenHandler((delegate, group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => {
delegate.setEditorOpenHandler((delegate, group, input, options?) => {
assert.strictEqual(input, inp);
done();
......
......@@ -128,8 +128,8 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
}
}
private debounce(event: Event<TextFileModelChangeEvent>): Event<ReadonlyArray<TextFileModelChangeEvent>> {
return Event.debounce(event, (prev: TextFileModelChangeEvent[], cur: TextFileModelChangeEvent) => {
private debounce(event: Event<TextFileModelChangeEvent>): Event<TextFileModelChangeEvent[]> {
return Event.debounce<TextFileModelChangeEvent, TextFileModelChangeEvent[]>(event, (prev, cur) => {
if (!prev) {
prev = [cur];
} else {
......
......@@ -414,7 +414,7 @@ suite('Files - TextFileService', () => {
});
});
async function hotExitTest(this: any, setting: string, shutdownReason: ShutdownReason, multipleWindows: boolean, workspace: true, shouldVeto: boolean): Promise<void> {
async function hotExitTest(this: any, setting: string, shutdownReason: ShutdownReason, multipleWindows: boolean, workspace: boolean, shouldVeto: boolean): Promise<void> {
model = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/file.txt'), 'utf8', undefined);
(<TextFileEditorModelManager>accessor.textFileService.models).add(model.resource, model);
......
......@@ -71,8 +71,8 @@ suite('QuickOpen', () => {
});
test('QuickOpen Action', () => {
let defaultAction = new QuickOpenAction('id', 'label', (undefined)!, new TestQuickOpenService((prefix: string) => assert(!prefix)));
let prefixAction = new QuickOpenAction('id', 'label', ',', new TestQuickOpenService((prefix: string) => assert(!!prefix)));
let defaultAction = new QuickOpenAction('id', 'label', (undefined)!, new TestQuickOpenService(prefix => assert(!prefix)));
let prefixAction = new QuickOpenAction('id', 'label', ',', new TestQuickOpenService(prefix => assert(!!prefix)));
defaultAction.run();
prefixAction.run();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册