Skip to content

Commit 29ab231

Browse files
zthcristianoc
authored andcommitted
add broken example test
1 parent ce08941 commit 29ab231

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

analysis/src/CompletionFrontEnd.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ let findArgCompletables ~(args : arg list) ~endPos ~posBeforeCursor
136136
})
137137
| _ -> loop args
138138

139+
(* TODO: Mimic pipe chain detection here? *)
139140
let rec exprToContextPath (e : Parsetree.expression) =
140141
match e.pexp_desc with
141142
| Pexp_constant (Pconst_string _) -> Some Completable.CPString
@@ -930,7 +931,11 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
930931
let oldScope = !scope in
931932
let oldCtxPath = !currentCtxPath in
932933
(* TODO: Haven't figured out how to count unlabelled args here yet... *)
933-
(* TODO: This is broken *)
934+
(* TODO: This is broken. I'm trying to set the CArgument context path
935+
below here continuously for each argument as I traverse the expr
936+
for the arg, but I end up piling them on each other. So what should
937+
be Carg $0, then Carg $1, then Carg $3... is now (faulty) Carg $0,
938+
then Carg Carg $0 $1, then Carg Carg Carg $0 $1 $2, and so on. *)
934939
(match !currentCtxPath with
935940
| None -> ()
936941
| Some ctxPath ->

analysis/tests/src/CompletionInferValues.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ module Div = {
4545

4646
// let _ = <Div onMouseEnter={event => { event->pr }} />
4747
// ^com
48+
49+
// Pipe are broken, need to fix
50+
// let _ = <div onMouseEnter={event => { let btn = event->JsxEvent.Mouse.button; btn-> }} />
51+
// ^com

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,13 @@ Completable: Cpath Value[event]->pr <<jsx>>
127127
"documentation": null
128128
}]
129129

130+
Complete src/CompletionInferValues.res 49:86
131+
posCursor:[49:86] posNoWhite:[49:85] Found expr:[49:12->49:92]
132+
JSX <div:[49:12->49:15] onMouseEnter[49:16->49:28]=...[49:36->49:88]> _children:49:90
133+
posCursor:[49:86] posNoWhite:[49:85] Found expr:[49:36->49:88]
134+
posCursor:[49:86] posNoWhite:[49:85] Found expr:[49:41->49:86]
135+
posCursor:[49:86] posNoWhite:[49:85] Found expr:[49:81->0:-1]
136+
posCursor:[49:86] posNoWhite:[49:85] Found expr:[49:81->0:-1]
137+
Completable: Cpath Value[btn]-> <<jsx>>
138+
[]
139+

0 commit comments

Comments
 (0)