Skip to content

Commit e9c21a0

Browse files
committed
Fix handling of local opens.
Fixes #420
1 parent 430bfe9 commit e9c21a0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

analysis/src/CompletionFrontEnd.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,13 @@ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
646646
iterator.expr iterator modBody;
647647
scope := oldScope;
648648
processed := true
649+
| Pexp_open (_, lid, e) ->
650+
let oldScope = !scope in
651+
iterator.location iterator lid.loc;
652+
scope := !scope |> Scope.addOpen ~lid:lid.txt;
653+
iterator.expr iterator e;
654+
scope := oldScope;
655+
processed := true
649656
| _ -> ());
650657
if not !processed then Ast_iterator.default_iterator.expr iterator expr
651658
in

analysis/tests/src/expected/Completion.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,13 +1495,13 @@ posCursor:[389:12] posNoWhite:[389:11] Found expr:[389:6->391:4]
14951495
posCursor:[389:12] posNoWhite:[389:11] Found expr:[389:6->389:12]
14961496
Completable: Cpath array->ma
14971497
[{
1498-
"label": "Js.Array2.mapi",
1498+
"label": "Array2.mapi",
14991499
"kind": 12,
15001500
"tags": [],
15011501
"detail": "(t<'a>, ('a, int) => 'b) => t<'b>",
15021502
"documentation": null
15031503
}, {
1504-
"label": "Js.Array2.map",
1504+
"label": "Array2.map",
15051505
"kind": 12,
15061506
"tags": [],
15071507
"detail": "(t<'a>, 'a => 'b) => t<'b>",

0 commit comments

Comments
 (0)