Owing to how Nova doesn’t have a blessed way to customize themes, I made the original sin of dirtying syntax definitions to achieve differentiation in syntax highlighting. I felt strongly that it would be helpful to see doc comments (used by language servers and documentation generators) highlighted differently than standard code comments, and chose to add tags for strings. The result is that doc comments don’t benefit from the automatic code folding Nova only does for comments and I need to provide my own queries.
One of the challenges is that multi-line comments aren’t parsed as a “block” or group – each line is a sibling node of other comment lines. I haven’t found a way to mimic Nova’s folding behavior for comments, where only the first comment line is shown and the rest are folded. Any help is appreciated!
Here are a few queries I've tried but that don't result in folding.
((line_comment)+ @subtree (#set! role comment)) ;Doc comments start with '///' or '//!' ((line_comment)+ @doccomment @subtree (#match? @doccomment "^//[/!]") (#set! role comment))