diff --git a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts index 3d695a84c97..9a5cfbdb383 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts @@ -475,26 +475,29 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable { next(): boolean { const length = this.hints.signatures.length; + const last = (this.currentSignature % length) === (length - 1); - if (length < 2) { + // If there is only one signature, or we're on last signature of list + if (length < 2 || last) { this.cancel(); return false; } - this.currentSignature = (this.currentSignature + 1) % length; + this.currentSignature++; this.render(); return true; } previous(): boolean { const length = this.hints.signatures.length; + const first = this.currentSignature === 0; - if (length < 2) { + if (length < 2 || first) { this.cancel(); return false; } - this.currentSignature = (this.currentSignature - 1 + length) % length; + this.currentSignature--; this.render(); return true; }