Fix issue with ordering of module opened via -open #842
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a very annoying issue where you wouldn't get autocomplete for "second order opens". I haven't added any tests because it'd be an incredibly noisy diff, but here's roughly what was wrong and what it caused:
bsc-flags
, like-open RescriptCore
. Everything works as expectedRescriptCore
open exposes a bunch of modules likeArray
,List
,Result
etc. All of these are available in autocomplete. So far, so good.-open RescriptCore
, likeopen Array
.Array
won't be exposed to autocomplete in this case.As can be seen by the minimal diff, this was a case of ordering. The list is reversed (correctly), but the order of
rawOpens
(coming from the local file) andpackageOpens
(coming from the package, bsconfig/rescript.json) was off, so the package opens actually ended up after the local opens when resolving autocomplete. This in turn lead to the contents of the opened modules not being exposed.Phew.