Something about tree-sitter I need to tell someone:
I have found (when I tried it last year) that for C (and C++ I presume), the existence of the preprocessor causes tree-sitter-mode serious problems. Using such common macros as #define list_for_each(...) for (...) or #define _unused_ __attribute__((unused)) makes it shit the bed. It treats list_for_each as a function and gets confused that it is followed by {...}, which is especially annoying as it then insists on indenting it incorrectly. Something like _unused_ can screw up the declaration parser and it can no longer figure out what the identifier is that's being declared. Also writing multi-line macros is a pain because when it auto-indents it fucks up my manual indentation, because it has no understanding of the thing; I suspect it doesn't attempt to parse macro bodies at all. You could probably disable auto-indent somehow for the whole mode, but I do want it to do that when it does it correctly.
Why doesn't someone fix this you may ask? Well...
In order to parse C macros properly and correctly, you'd need to run the code through a cpp of some kind before handing it over to tree-sitter. That would of course mean it has to parse the headers also, and in order to find the headers reliably it would need to be told the compiler flags. It would also need to be able to map file positions back to its original non-preprocessed sources. Also imagine it having to go through approximately one billion lines of C++ templates for every STL include.
Doing all this seems hard, so I can see why they don't do that, but unfortunately it's worse than cc-mode right now (or rather last year when I tried it), which kind of muddles through all this stuff.
Maybe tree-sitter-mode could muddle through also somehow? Maybe by modifying the grammar, one could alter how exactly it misparses code involving such macros and then at least it would get the indentation correct. Also possibly one could do a mode on top of tree-sitter-mode that overrides the indentation stuff but keeps tree-sitter-mode's syntax highlighting, which can be incorrect in the face of macros, but is overall more sophisticated than cc-mode's.