Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close param hints if you reach out of bounds of list instead of cycling #53757

Merged
merged 2 commits into from
Jul 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -451,26 +451,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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might as well update the lower bits in these functions because now you won't ever reach them with the spill over/under.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Will update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrieken okay - how's that?

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