Skip to content

Commit aca03b1

Browse files
committed
Add test for completion inside templates.
1 parent 312c62e commit aca03b1

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

analysis/tests/src/Completion.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,7 @@ module FAO = {
232232

233233
// FAO.forAutoObject["forAutoLabel"].forAuto->ForAuto.a
234234
// ^com
235+
236+
let name = "abc"
237+
// let template = `My name is ${na}`
238+
// ^com

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,11 @@ DocumentSymbol tests/src/Completion.res
827827
"name": "forAutoObject",
828828
"kind": 13,
829829
"location": {"uri": "Completion.res", "range": {"start": {"line": 220, "character": 2}, "end": {"line": 220, "character": 68}}}
830+
},
831+
{
832+
"name": "name",
833+
"kind": 15,
834+
"location": {"uri": "Completion.res", "range": {"start": {"line": 235, "character": 0}, "end": {"line": 235, "character": 16}}}
830835
}
831836
]
832837

@@ -1228,8 +1233,8 @@ Completable: Cpath Value[FAO, forAutoObject][""]
12281233
}]
12291234

12301235
Complete tests/src/Completion.res 226:37
1231-
posCursor:[226:37] posNoWhite:[226:36] Found expr:[226:3->235:0]
1232-
Pexp_field [226:3->226:36] _:[235:0->235:0]
1236+
posCursor:[226:37] posNoWhite:[226:36] Found expr:[226:3->235:3]
1237+
Pexp_field [226:3->226:36] _:[235:0->235:3]
12331238
Completable: Cpath Value[FAO, forAutoObject]["forAutoLabel"].""
12341239
[{
12351240
"label": "forAuto",
@@ -1281,3 +1286,23 @@ Completable: Cpath Value[ForAuto, a]
12811286
"documentation": null
12821287
}]
12831288

1289+
Complete tests/src/Completion.res 236:34
1290+
posCursor:[236:34] posNoWhite:[236:33] Found expr:[236:18->236:36]
1291+
Pexp_apply ...__ghost__[0:-1->0:-1] (...[236:18->236:32], ...[236:32->236:34])
1292+
posCursor:[236:34] posNoWhite:[236:33] Found expr:[236:32->236:34]
1293+
Pexp_ident na:[236:32->236:34]
1294+
Completable: Cpath Value[na]
1295+
[{
1296+
"label": "name",
1297+
"kind": 12,
1298+
"tags": [],
1299+
"detail": "string",
1300+
"documentation": null
1301+
}, {
1302+
"label": "nan",
1303+
"kind": 12,
1304+
"tags": [],
1305+
"detail": "float",
1306+
"documentation": null
1307+
}]
1308+

0 commit comments

Comments
 (0)