Skip to content

Commit

Permalink
Merge pull request #53757 from itamark/cycle-out-of-param-hints-after…
Browse files Browse the repository at this point in the history
…-one

Close param hints if you reach out of bounds of list instead of cycling
  • Loading branch information
jrieken committed Jul 10, 2018
2 parents adfa9ce + d056635 commit 39f976c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 39f976c

Please sign in to comment.