File tree Expand file tree Collapse file tree 2 files changed +12
-41
lines changed Expand file tree Collapse file tree 2 files changed +12
-41
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,14 @@ let parser ~debug ~emitter ~path =
217
217
Ast_mapper. default_mapper.expr mapper e
218
218
| Pexp_apply ({pexp_desc = Pexp_ident lident; pexp_loc}, args)
219
219
when Res_parsetree_viewer. isJsxExpression e ->
220
+ (*
221
+ Angled brackets:
222
+ - These are handled in the grammar: <> </> </ />
223
+ - Here we handle `<` and `>`
224
+
225
+ Component names:
226
+ - handled like other Longitent.t, except lowercase id is marked Token.JsxLowercase
227
+ *)
220
228
let rec isSelfClosing args =
221
229
match args with
222
230
| [] -> false
@@ -231,7 +239,7 @@ let parser ~debug ~emitter ~path =
231
239
true
232
240
| _ :: rest -> isSelfClosing rest
233
241
in
234
- emitter
242
+ emitter (* --> <div.. *)
235
243
|> emitJsxTag ~debug ~name: " <"
236
244
~pos:
237
245
(let pos = Utils. tupleOfLexing e.pexp_loc.loc_start in
@@ -262,7 +270,7 @@ let parser ~debug ~emitter ~path =
262
270
~pos:
263
271
(let pos = Utils. tupleOfLexing e.pexp_loc.loc_end in
264
272
(fst pos, snd pos - 1 ))));
265
- (* only process again arguments, not the jsx label *)
273
+
266
274
let _ = args |> List. map (fun (_lbl , arg ) -> mapper.expr mapper arg) in
267
275
e
268
276
| Pexp_apply
Original file line number Diff line number Diff line change 364
364
]
365
365
},
366
366
"jsx" : {
367
- "patterns" : [
368
- {
369
- "match" : " <>|</>|/>" ,
370
- "name" : " punctuation.definition.tag"
371
- },
372
- {
373
- "match" : " </([A-Z_][0-9a-zA-Z_]*)" ,
374
- "captures" : {
375
- "0" : {
376
- "name" : " punctuation.definition.tag"
377
- },
378
- "1" : {
379
- "name" : " entity.name.namespace"
380
- }
381
- }
382
- },
383
- {
384
- "match" : " </([a-z_][0-9a-zA-Z_]*)" ,
385
- "captures" : {
386
- "0" : {
387
- "name" : " punctuation.definition.tag"
388
- },
389
- "1" : {
390
- "name" : " variable"
391
- }
392
- }
393
- },
394
- {
395
- "match" : " <([A-Z_][0-9a-zA-Z_]*)" ,
396
- "captures" : {
397
- "0" : {
398
- "name" : " punctuation.definition.tag"
399
- },
400
- "1" : {
401
- "name" : " entity.name.namespace"
402
- }
403
- }
404
- }
405
- ]
367
+ "match" : " <>|</>|</|/>" ,
368
+ "name" : " punctuation.definition.tag"
406
369
},
407
370
"openOrIncludeModule" : {
408
371
"patterns" : [
You can’t perform that action at this time.
0 commit comments