Skip to content

Commit ed18035

Browse files
committed
Fix pipe completion across files.
1 parent 023a74a commit ed18035

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
927927
if pathFromEnv = [] then None
928928
else if
929929
env.file.moduleName <> envFromCompletionItem.file.moduleName
930+
&& found
931+
(* If the module names are different, then one needs to qualify the path.
932+
But only if the path belongs to the env from completion *)
930933
then Some (envFromCompletionItem.file.moduleName :: pathFromEnv)
931934
else Some pathFromEnv
932935
| _ -> None)

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,18 @@ Path CompletionSupport2.makeRenderer
799799
CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2.Internal
800800
CPPipe type path:ReactDOM.Client.Root.t
801801
CPPipe pathFromEnv:ReactDOM.Client.Root found:false
802-
Path CompletionSupport2.ReactDOM.Client.Root.
803-
[]
802+
Path ReactDOM.Client.Root.
803+
[{
804+
"label": "ReactDOM.Client.Root.unmount",
805+
"kind": 12,
806+
"tags": [],
807+
"detail": "(t, unit) => unit",
808+
"documentation": null
809+
}, {
810+
"label": "ReactDOM.Client.Root.render",
811+
"kind": 12,
812+
"tags": [],
813+
"detail": "(t, React.element) => unit",
814+
"documentation": null
815+
}]
804816

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,14 @@ Path props
424424
CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionSupport.Nested
425425
CPPipe type path:ReactDOM.Client.Root.t
426426
CPPipe pathFromEnv:ReactDOM.Client.Root found:false
427-
Path CompletionSupport.ReactDOM.Client.Root.ren
428-
[]
427+
Path ReactDOM.Client.Root.ren
428+
[{
429+
"label": "ReactDOM.Client.Root.render",
430+
"kind": 12,
431+
"tags": [],
432+
"detail": "(t, React.element) => unit",
433+
"documentation": null
434+
}]
429435

430436
Complete src/CompletionPipeChain.res 88:16
431437
posCursor:[88:16] posNoWhite:[88:15] Found expr:[76:15->93:1]

0 commit comments

Comments
 (0)