Merge pull request #53757 from itamark/cycle-out-of-param-hints-after-one

Close param hints if you reach out of bounds of list instead of cycling
This commit is contained in:
Johannes Rieken
2018-07-10 09:39:30 +02:00
committed by GitHub

View File

@@ -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;
}