Fold stopped working with lezer generated parser

Hey there,

I extended json grammar with some custom tokens:

@top JsonText { value }

value { True | False | Null | Number | String | Object | Array | TemplateExpression }

String { string }
Object { "{" list<Property>? "}" }
Array  { "[" list<value>? "]" }
Property { PropertyName ":" value }
PropertyName { string }
TemplateExpression { "{{" String "}}" }



@tokens {
  True  { "true" }
  False { "false" }
  Null  { "null" }

  Number { '-'? int frac? exp?  }
  int  { '0' | $[1-9] std.digit* }
  frac { '.' std.digit+ }
  exp  { $[eE] $[+\-]? std.digit+ }

  string { '"' char* '"' }
  char { $[\u{20}\u{21}\u{23}-\u{5b}\u{5d}-\u{10ffff}] | "\\" esc }
  esc  { $["\\\/bfnrt] | "u" hex hex hex hex }
  hex  { $[0-9a-fA-F] }

  whitespace { $[ \n\r\t] }

  "{" "}" "[" "]" "{{" "}}"
}

@skip { whitespace }
list<item> { item ("," item)* }

@external propSource jsonHighlighting from "./highlight"

@detectDelim

And defined it like that:

const jsonTemplateMode = LRLanguage.define({
    parser: jsonExtendedParser,
});  

And the folding stopped working… Now I am pretty sure I missed some configuration but I am not sure how to do it.

I even tried to extend my language with json().extension but it seems to override my language completely.

Any help will be much appreciated :pray: Thanks

See here for the props lang-json adds to implement folding.