Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit c57ed6d

Browse files
committed
Fix priority in multiple opens.
Fixes #72
1 parent 33287cf commit c57ed6d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Fix type hint when hovering over labeled arguments of components (See https://github.com/rescript-lang/rescript-editor-support/issues/63).
1212
- Fix issue where values declared with type annotation would not show up in autocomplete, and would show no doc comment on hover. (See https://github.com/rescript-lang/rescript-vscode/issues/72).
1313
- Fix hover on definitions inside a react component module, or whenever multiple definitins for the same value exist in the module (See https://github.com/rescript-lang/rescript-editor-support/issues/67).
14+
- Fix autocomplete issue where multiple open's were considered in the wrong priority order (See https://github.com/rescript-lang/rescript-editor-support/issues/72).
1415

1516
## Release 1.0.5 of rescript-vscode
1617
This [commit](https://github.com/rescript-lang/rescript-editor-support/commit/6bdd10f6af259edc5f9cbe5b9df06836de3ab865) is vendored in [rescript-vscode 1.0.5](https://github.com/rescript-lang/rescript-vscode/releases/tag/1.0.5).

src/rescript-editor-support/NewCompletions.re

+6-3
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,20 @@ let getItems =
445445
let packageOpens = ["Pervasives", ...package.TopTypes.opens];
446446
Log.log("Package opens " ++ String.concat(" ", packageOpens));
447447

448-
let opens = resolveRawOpens(~env, ~getModule, ~rawOpens, ~package);
448+
let resolvedOpens = resolveRawOpens(~env, ~getModule, ~rawOpens, ~package);
449449
Log.log(
450450
"Opens nows "
451-
++ string_of_int(List.length(opens))
451+
++ string_of_int(List.length(resolvedOpens))
452452
++ " "
453453
++ String.concat(
454454
" ",
455-
opens |> List.map(e => Uri2.toString(e.Query.file.uri)),
455+
resolvedOpens |> List.map(e => Uri2.toString(e.Query.file.uri)),
456456
),
457457
);
458458

459+
// Last open takes priority
460+
let opens = List.rev(resolvedOpens);
461+
459462
switch (parts) {
460463
| [] => []
461464
| [suffix] =>

0 commit comments

Comments
 (0)