Don't cancel signature help until next real trigger
Fixes #58492 **Bug** If multiple triggers come in at the same time, we currently lose the re-trigger state. This is caused by each trigger canceling the existing request. The first one is treated as a re-trigger, but all subsquent triggers look like fresh triggers **Fix** Move the cancelation into the actual trigger body.
This commit is contained in:
parent
8047109d3d
commit
c4a8608f12
2 changed files with 4 additions and 7 deletions
|
@ -99,8 +99,6 @@ export class ParameterHintsModel extends Disposable {
|
|||
}
|
||||
|
||||
trigger(context: TriggerContext, delay?: number): void {
|
||||
const wasTriggered = this.isTriggered;
|
||||
this.cancel(true);
|
||||
|
||||
const model = this.editor.getModel();
|
||||
if (model === null || !modes.SignatureHelpProviderRegistry.has(model)) {
|
||||
|
@ -111,14 +109,12 @@ export class ParameterHintsModel extends Disposable {
|
|||
() => this.doTrigger({
|
||||
triggerReason: context.triggerReason,
|
||||
triggerCharacter: context.triggerCharacter,
|
||||
isRetrigger: wasTriggered
|
||||
isRetrigger: this.isTriggered,
|
||||
}), delay).then(undefined, onUnexpectedError);
|
||||
}
|
||||
|
||||
private doTrigger(triggerContext: modes.SignatureHelpContext): Promise<boolean> {
|
||||
if (this.provideSignatureHelpRequest) {
|
||||
this.provideSignatureHelpRequest.cancel();
|
||||
}
|
||||
this.cancel(true);
|
||||
|
||||
if (!this.editor.hasModel()) {
|
||||
return Promise.resolve(false);
|
||||
|
|
|
@ -150,8 +150,9 @@ suite('ParameterHintsModel', () => {
|
|||
|
||||
provideSignatureHelp(_model: ITextModel, _position: Position, _token: CancellationToken, context: modes.SignatureHelpContext): modes.SignatureHelp | Thenable<modes.SignatureHelp> {
|
||||
++invokeCount;
|
||||
|
||||
assert.strictEqual(context.triggerReason, modes.SignatureHelpTriggerReason.TriggerCharacter);
|
||||
assert.ok(context.isRetrigger);
|
||||
assert.strictEqual(context.isRetrigger, false);
|
||||
assert.strictEqual(context.triggerCharacter, 'c');
|
||||
|
||||
// Give some time to allow for later triggers
|
||||
|
|
Loading…
Reference in a new issue