diff --git a/Changes.md b/Changes.md index 9a6bc1485..5df85d02d 100644 --- a/Changes.md +++ b/Changes.md @@ -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). diff --git a/src/rescript-editor-support/NewCompletions.re b/src/rescript-editor-support/NewCompletions.re index 7451316ac..de4d71401 100644 --- a/src/rescript-editor-support/NewCompletions.re +++ b/src/rescript-editor-support/NewCompletions.re @@ -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] =>