-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
…e latter does not support breaking out of the loop early, and hence breaks provider selection. In particular, Edge Web Fonts was broken by this.
…commit broke limiting the CodeHintList to displaying at most maxResults hints.
Oh, I didn't checked the break in the There is another $.each that was broken in |
@TomMalbran Don't worry, I also missed this on review :( An important issue here, then, is that we don't have this covered with any test. It would be nice to add one now, so this doesn't slip again. |
I verified this fixed Edge Web Fonts. Merging. |
Fix code hint provider selection
@iwehrman I think it's worth filing a spinoff bug to wrap up the loose ends mentioned above: switching this to Array.some() (achieving the goals of the cleanup #3087); and adding a unit test (especially since it breaks a prominent extension and isn't something we'd be able to spot with pure Brackets scenario testing). |
See #3223 regarding unit tests for the CodeHintManager. I'm not sure replacing |
We've standardized on using Array.forEach()/.some() instead, and it's what all other code in the product uses (in general we prefer to use modern browser APIs where available). |
Commit 5878608 replaced a number of instances of
$.each
withArray.forEach
. But those functions are not interchangeable: only the former supports early break-out. Both the CodeHintManager and the CodeHintList relied on this feature. In particular, that commit broke:CodeHintManager provider selection, by always choosing the last provider instead of stopping at the first, highest-priority provider
the CodeHintList, by adding all the available hints instead of of just the first
maxResults
hints.The first issue also breaks Edge Web Fonts in particular.
This pull reverts just those two changes. I haven't checked all the other replacements from that commit to see if there are other related problems. (Want to have a look, @TomMalbran?)