I just made an extension for OCaml since the existing one doesn’t work.
While defining the syntax for OCaml, I came across the issue of brackets. I’m defining brackets for OCaml, since there is more than {, (, [.
Yes! There’s also these: [|, |] for arrays… And you might have guessed it, these brackets are two characters long.
I’m defining them that way in the OCaml.xml syntax file:
Yea… that is the same problem with php Blade extension. {{php stuff}}, or {!! php stuff !!}. It would be nice for Nova to support the multiple characters tbh.
There was a hack that was mentioned in an issue raised on github for the Blade. Basically removing the pair and going for singles.
changing <pair open="{{" close="}}" /> <pair open="{" close="}" /> which is actually a default by Nova anyways.
This was more pleasant and symmetric but Nova coloured each { and } separately as if it is nested
In your case I would suggest trying each individually? Basically breaking [| x |]:
That was a genius idea, but there must be something in the background preventing this, because | are not matched automatically, no matter if using them in an array or testing them alone.
Mmm I gave it a shot myself but it actually sounds like a bug
I would suggest marking this as a bug here by changing the category.
The editor picks up the fact that | x | is wrapping but fails to highlight…, funny enough if you use [| x |] it only paints half of it.
Also again Nova should autoclose automatically but it does not…
One way you could maybe bypass, could be maybe using the tree-sitter [Autoclose] feature (Tree-sitter - Nova)
In terms of colour situation I managed to find a way to fix but these are all hacky and I wished Nova had a better support for brackets and so fort, considering weird combos are very common across all frameworks
The hack I did was using the tree-sitter highlighter, and grabbing the brackets, here is an example. But for it work you have to uncheck the rainbow bracket…