Fixes test.

This commit is contained in:
Henning Dieterichs 2021-08-23 00:11:48 +02:00
parent 60c88bb233
commit f55f681b97
No known key found for this signature in database
GPG key ID: 771381EFFDB9EC06
2 changed files with 5 additions and 9 deletions

View file

@ -35,7 +35,7 @@ export class InlineCompletionsModel extends Disposable implements GhostTextWidge
constructor(
private readonly editor: IActiveCodeEditor,
private readonly cache: SharedInlineCompletionCache,
private readonly commandService: ICommandService,
@ICommandService private readonly commandService: ICommandService,
) {
super();

View file

@ -86,7 +86,7 @@ suite('Inline Completions', () => {
});
});
test('Does trigger automatically if disabled', async function () {
test('Does not trigger automatically if disabled', async function () {
const provider = new MockInlineCompletionsProvider();
await withAsyncTestCodeEditorAndInlineCompletionsModel('',
{ fakeClock: true, provider, inlineSuggest: { enabled: false } },
@ -149,13 +149,14 @@ suite('Inline Completions', () => {
async ({ editor, editorViewModel, model, context }) => {
model.setActive(true);
context.keyboardType('foo');
provider.setReturnValue({ text: 'foobar', range: new Range(1, 1, 1, 4) });
context.keyboardType('foo');
model.trigger();
await timeout(1000);
provider.setReturnValue({ text: 'foobizz', range: new Range(1, 1, 1, 6) });
context.keyboardType('bi');
context.keyboardType('b');
context.keyboardType('i');
await timeout(1000);
assert.deepStrictEqual(provider.getAndClearCallHistory(), [
@ -451,11 +452,6 @@ suite('Inline Completions', () => {
{ position: '(1,5)', text: 'foob', triggerKind: 0, }
]);
assert.deepStrictEqual(context.getAndClearViewStates(), [
/*
TODO: Remove this flickering. Fortunately, it is not visible.
It is caused by the text model updating before the cursor position.
*/
'foob',
'foob[ar]',
'foob[az]'
]);