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

Commit bad6e78

Browse files
committed
Autocomplete for builtin option type.
1 parent dd83be0 commit bad6e78

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

examples/example-project/src/ZZ.res

+3
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,6 @@ let abc = "abc"
140140

141141
let arr = [1, 2, 3]
142142

143+
let some7 = Some(7)
144+
145+

src/NewCompletions.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ let processCompletable ~findItems ~full ~package ~pos ~rawOpens
514514
~detail:(detail name item) ~docstring ~uri ~pos_lnum)
515515
| Cpipe (pipe, partialName) -> (
516516
let arrayModulePath = ["Js"; "Array2"] in
517+
let optionModulePath = ["Belt"; "Option"] in
517518
let stringModulePath = ["Js"; "String2"] in
518519
let getModulePath path =
519520
let rec loop (path : Path.t) =
@@ -523,8 +524,9 @@ let processCompletable ~findItems ~full ~package ~pos ~rawOpens
523524
| Papply _ -> []
524525
in
525526
match path with
526-
| Path.Pident id when Ident.name id = "string" -> stringModulePath
527527
| Path.Pident id when Ident.name id = "array" -> arrayModulePath
528+
| Path.Pident id when Ident.name id = "option" -> optionModulePath
529+
| Path.Pident id when Ident.name id = "string" -> stringModulePath
528530
| _ -> ( match loop path with _ :: rest -> List.rev rest | [] -> [])
529531
in
530532
let getLhsPath ~pipeId ~partialName =

0 commit comments

Comments
 (0)