-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #8763: Limit number of import suggestions #8773
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
Conversation
Limit number of import suggestions and make computing the top-ranked suggestions more efficient.
|
||
/** The best `n` references in `refs`, according to `compare` | ||
* `compare` is a partial order. If there's a tie, we take elements | ||
* in the order thy appear in the list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small typo: thy should probably be they.
Since it fixes a potential very long compilation, it would be good to have this in 0.24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds reasonable. Should we also run the benchmarks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
var i = 0 | ||
var diff = 0 | ||
while i < filled && diff == 0 do | ||
diff = compare(ref, top(i))(using ctx.retractMode(Mode.ImplicitsEnabled)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Store ctx.retractMode(Mode.ImplicitsEnabled)
in a val to avoid recomputing it at every iteration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarter could you apply this fix directly, as per fasttrack
label policy?
We don't have any benchmark infrastructure for code that contains compilation errors, so no way to benchmark this |
Limit number of import suggestions and make computing the
top-ranked suggestions more efficient.