Skip to content

Commit

Permalink
Fix priority in multiple opens.
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoc committed Mar 15, 2021
1 parent 33287cf commit c57ed6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit c57ed6d

Please sign in to comment.