Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fit typings for concrete version of createInstance #166320

Merged
merged 1 commit into from Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -4,22 +4,21 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import { CancellationToken } from 'vs/base/common/cancellation';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { mock } from 'vs/base/test/common/mock';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { CompletionContext, CompletionItem, CompletionItemKind, CompletionItemProvider, CompletionList, InlineCompletionTriggerKind, ProviderResult } from 'vs/editor/common/languages';
import { createTextModel } from 'vs/editor/test/common/testTextModel';
import { ITextModel } from 'vs/editor/common/model';
import { TextModel } from 'vs/editor/common/model/textModel';
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
import { SuggestInlineCompletions } from 'vs/editor/contrib/suggest/browser/suggestInlineCompletions';
import { ISuggestMemoryService } from 'vs/editor/contrib/suggest/browser/suggestMemory';
import { createCodeEditorServices, instantiateTestCodeEditor, ITestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { CancellationToken } from 'vs/base/common/cancellation';
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
import { ITextModel } from 'vs/editor/common/model';
import { Range } from 'vs/editor/common/core/range';
import { createTextModel } from 'vs/editor/test/common/testTextModel';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { ISuggestMemoryService } from 'vs/editor/contrib/suggest/browser/suggestMemory';
import { mock } from 'vs/base/test/common/mock';
import { TextModel } from 'vs/editor/common/model/textModel';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';


Expand Down Expand Up @@ -73,7 +72,7 @@ suite('Suggest Inline Completions', function () {

test('Aggressive inline completions when typing within line #146948', async function () {

const completions: SuggestInlineCompletions = insta.createInstance(SuggestInlineCompletions, (id: EditorOption) => editor.getOption(id));
const completions: SuggestInlineCompletions = insta.createInstance(SuggestInlineCompletions, (id) => editor.getOption(id));

{
// (1,3), end of word -> suggestions
Expand Down
Expand Up @@ -72,7 +72,6 @@ export class InstantiationService implements IInstantiationService {
}
}

createInstance(ctorOrDescriptor: any | SyncDescriptor<any>, ...rest: any[]): any; // Comment out this line to fix type issues
createInstance<T>(descriptor: SyncDescriptor0<T>): T;
createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
createInstance(ctorOrDescriptor: any | SyncDescriptor<any>, ...rest: any[]): any {
Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/api/test/browser/mainThreadWorkspace.test.ts
Expand Up @@ -45,7 +45,7 @@ suite('MainThreadWorkspace', () => {
}
});

const mtw: MainThreadWorkspace = instantiationService.createInstance(<any>MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
const mtw = instantiationService.createInstance(MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
return mtw.$startFileSearch('foo', null, null, 10, new CancellationTokenSource().token);
});

Expand All @@ -67,7 +67,7 @@ suite('MainThreadWorkspace', () => {
}
});

const mtw: MainThreadWorkspace = instantiationService.createInstance(<any>MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
const mtw = instantiationService.createInstance(MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
return mtw.$startFileSearch('', null, null, 10, new CancellationTokenSource().token);
});

Expand All @@ -88,7 +88,7 @@ suite('MainThreadWorkspace', () => {
}
});

const mtw: MainThreadWorkspace = instantiationService.createInstance(<any>MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
const mtw = instantiationService.createInstance(MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
return mtw.$startFileSearch('', null, false, 10, new CancellationTokenSource().token);
});

Expand All @@ -102,7 +102,7 @@ suite('MainThreadWorkspace', () => {
}
});

const mtw: MainThreadWorkspace = instantiationService.createInstance(<any>MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
const mtw = instantiationService.createInstance(MainThreadWorkspace, SingleProxyRPCProtocol({ $initializeWorkspace: () => { } }));
return mtw.$startFileSearch('', null, 'exclude/**', 10, new CancellationTokenSource().token);
});
});
Expand Up @@ -36,6 +36,11 @@ class TestTerminal implements Partial<ITerminalInstance> {
}

class TestTask extends CommonTask {

constructor() {
super('test', undefined, undefined, {}, {}, { kind: '', label: '' });
}

protected getFolderId(): string | undefined {
throw new Error('Method not implemented.');
}
Expand Down Expand Up @@ -67,7 +72,7 @@ suite('Task Terminal Status', () => {
audioCueService = new TestAudioCueService();
taskTerminalStatus = new TaskTerminalStatus(taskService as any, audioCueService as any);
testTerminal = instantiationService.createInstance(TestTerminal) as any;
testTask = instantiationService.createInstance(TestTask);
testTask = instantiationService.createInstance(TestTask) as unknown as Task;
problemCollector = instantiationService.createInstance(TestProblemCollector) as any;
});
test('Should add failed status when there is an exit code on task end', async () => {
Expand Down