nested language syntax highlighting not working

Hi there, so I have implemented a new custom language with a nested yaml, however the yaml syntax highlighting doesn’t seem to work, I simply pass a range to the mixedParse as overlay and the yaml parser as the parser filed of mixedPraser return, but the syntax highlighting for that range is simply blank, any idea how to I can fix this?
I should note that the normal syntax highlighting of the rest of the text works fine, but only that part which should be highlighted as yaml is simply blank

guys anyone has any idea about how I can tackle this issue?

so this how I have setup the nested yaml in my custom language:
wondering what Im missing that the part that is suppose to be highlighted as yaml, is just blank with no highlighting. would appreciate it if anyone can help.

An overlay range that goes from 0 to the start of the node seems wrong. Overlay ranges have to cover the code inside the node that the mixed parsing function is currently looking at.

well when an overlay range is applied, does it really matter that that section of the text is a node or not?

how I wrote the grammar is that the nodes are parsed right after the delimiter of the yaml and rest of the text which is the custom lang, like below:

some yaml
“—” (this is delimiter)
rest of the text in custom lang

so the grammar doesnt parse the yaml section into a node, rather the delimiter is parsed into a node (FrontMatterSplitter) and then a range from the start to the start of that node is passed for nested lang.

so wont this setup work as it doesnt parse the yaml alaready into a node?

No. But the way parseMixed works, an overlay must be inside the node that it is associated with (i.e. the node for which the callback returns the overlay info).

1 Like