From 07717a6909f515b4961212df9ddb1bd82c704a87 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sun, 13 Nov 2022 13:00:09 +0100 Subject: [PATCH] adjust autocomplete to recent changes in stdlib --- analysis/src/CompletionBackEnd.ml | 6 ++++-- analysis/src/Packages.ml | 6 +++++- analysis/src/SharedTypes.ml | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index 670792189..b7240a297 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -1290,6 +1290,8 @@ let rec getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos intModulePath; floatModulePath; promiseModulePath; + listModulePath; + resultModulePath; } = package.builtInCompletionModules in @@ -1307,9 +1309,9 @@ let rec getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos | Path.Pident id when Ident.name id = "int" -> intModulePath | Path.Pident id when Ident.name id = "float" -> floatModulePath | Path.Pident id when Ident.name id = "promise" -> promiseModulePath - | Path.Pident id when Ident.name id = "list" -> ["Belt"; "List"] + | Path.Pident id when Ident.name id = "list" -> listModulePath + | Path.Pident id when Ident.name id = "result" -> resultModulePath | Path.Pident id when Ident.name id = "lazy_t" -> ["Lazy"] - | Path.Pident id when Ident.name id = "result" -> ["Belt"; "Result"] | Path.Pident id when Ident.name id = "char" -> ["Char"] | _ -> ( match loop path with diff --git a/analysis/src/Packages.ml b/analysis/src/Packages.ml index 2a4bd73bd..7e2ca25e0 100644 --- a/analysis/src/Packages.ml +++ b/analysis/src/Packages.ml @@ -98,7 +98,7 @@ let newBsPackage ~rootPath = opens_from_bsc_flags |> List.find_opt (fun opn -> match opn with - | ["ReScriptStdLib"] -> true + | ["RescriptStdlib"] -> true | _ -> false) |> Option.is_some then @@ -109,6 +109,8 @@ let newBsPackage ~rootPath = intModulePath = ["Int"]; floatModulePath = ["Float"]; promiseModulePath = ["Promise"]; + listModulePath = ["List"]; + resultModulePath = ["Result"]; } else { @@ -118,6 +120,8 @@ let newBsPackage ~rootPath = intModulePath = ["Belt"; "Int"]; floatModulePath = ["Belt"; "Float"]; promiseModulePath = ["Js"; "Promise"]; + listModulePath = ["Belt"; "List"]; + resultModulePath = ["Belt"; "Result"]; }); }))) | None -> None) diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index 906669e78..d007c20b0 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -368,6 +368,8 @@ type builtInCompletionModules = { intModulePath: string list; floatModulePath: string list; promiseModulePath: string list; + listModulePath: string list; + resultModulePath: string list; } type package = {