mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
This commit is contained in:
parent
6adec5fc8e
commit
accdf1078f
|
@ -382,7 +382,7 @@ CommandsRegistry.registerCommand('_executeCompletionItemProvider', async (access
|
|||
};
|
||||
|
||||
const resolving: Promise<any>[] = [];
|
||||
const completions = await provideSuggestionItems(completionProvider, ref.object.textEditorModel, Position.lift(position), undefined, { triggerCharacter, triggerKind: triggerCharacter ? languages.CompletionTriggerKind.TriggerCharacter : languages.CompletionTriggerKind.Invoke });
|
||||
const completions = await provideSuggestionItems(completionProvider, ref.object.textEditorModel, Position.lift(position), undefined, { triggerCharacter: triggerCharacter ?? undefined, triggerKind: triggerCharacter ? languages.CompletionTriggerKind.TriggerCharacter : languages.CompletionTriggerKind.Invoke });
|
||||
for (const item of completions.items) {
|
||||
if (resolving.length < (maxItemsToResolve ?? 0)) {
|
||||
resolving.push(item.resolve(CancellationToken.None));
|
||||
|
|
|
@ -722,6 +722,25 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
|||
|
||||
// --- suggest
|
||||
|
||||
test('triggerCharacter is null when completion provider is called programmatically #159914', async function () {
|
||||
|
||||
let actualContext: vscode.CompletionContext | undefined;
|
||||
|
||||
disposables.push(extHost.registerCompletionItemProvider(nullExtensionDescription, defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(_doc, _pos, _tok, context): any {
|
||||
actualContext = context;
|
||||
return [];
|
||||
}
|
||||
}, []));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
|
||||
await commands.executeCommand<vscode.CompletionList>('vscode.executeCompletionItemProvider', model.uri, new types.Position(0, 4));
|
||||
|
||||
assert.ok(actualContext);
|
||||
assert.deepStrictEqual(actualContext, { triggerKind: types.CompletionTriggerKind.Invoke, triggerCharacter: undefined });
|
||||
});
|
||||
|
||||
test('Suggest, back and forth', function () {
|
||||
disposables.push(extHost.registerCompletionItemProvider(nullExtensionDescription, defaultSelector, <vscode.CompletionItemProvider>{
|
||||
provideCompletionItems(): any {
|
||||
|
|
Loading…
Reference in a new issue