> > It indeed works much better, thanks! > > I found a bug and a way to replicate it (you'll need to update your Bison grammar): > - Open the file "treesit-bug-highlighting-demo"; > - Enable bison-ts-mode; > - At the beginning of the second line (the part managed by the embedded C parser, with "static void ..."), add a space; > > => The whole line loses its highlighting. > > If you add a space again, the highlighting works correctly again. > Not a big issue, but pretty weird. Thanks. Weird indeed. I found the bug and fixed it. Latest master should work fine now. > > Also, I have one (last?) question: > > Since the C code uses its own indentation, it's entirely independent of Bison's nodes positions. > Is it possible to add an offset to the indentation of the embedded parts, relative to its container node? > > For instance, rather than: > > %% > grammar_declaration: > grammar_rule > { > int myvar; > } > ; > %% > > > > I would like to get > > > > %% > grammar_declaration: > grammar_rule > { > int myvar; > } > ; > %% > > > ("int myvar;" is managed by a C parser). Makes sense. You can use a custom matcher to indent the top level nodes in the C code. I modified your mode for a POC. The modified parts are marked with "!!!". Yuan