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

Fix priority in multiple opens. #74

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fix type hint when hovering over labeled arguments of components (See https://github.com/rescript-lang/rescript-editor-support/issues/63).
- 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).
- 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).
- 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).

## Release 1.0.5 of rescript-vscode
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).
Expand Down
9 changes: 6 additions & 3 deletions src/rescript-editor-support/NewCompletions.re
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,20 @@ let getItems =
let packageOpens = ["Pervasives", ...package.TopTypes.opens];
Log.log("Package opens " ++ String.concat(" ", packageOpens));

let opens = resolveRawOpens(~env, ~getModule, ~rawOpens, ~package);
let resolvedOpens = resolveRawOpens(~env, ~getModule, ~rawOpens, ~package);
Log.log(
"Opens nows "
++ string_of_int(List.length(opens))
++ string_of_int(List.length(resolvedOpens))
++ " "
++ String.concat(
" ",
opens |> List.map(e => Uri2.toString(e.Query.file.uri)),
resolvedOpens |> List.map(e => Uri2.toString(e.Query.file.uri)),
),
);

// Last open takes priority
let opens = List.rev(resolvedOpens);

switch (parts) {
| [] => []
| [suffix] =>
Expand Down