Open mtaran-google opened 5 years ago
What would such a macro expand to? Is there anything in C++ that can come between a variable name and its initializer?
In clang you can put an annotation there, which is used extensively for thread safety analysis: https://abseil.io/docs/cpp/guides/synchronization#annotation-guidelines
Attached patch should address this case.
Regarding your proposal for indentation, that's not something that's easy to build onto this system, and seems like it would often still do the wrong thing.
I disagree about the indentation. Sure, keeping the same indentation might sometimes do the wrong thing. But resetting indentation to 0 will almost always do the wrong thing.
There is no code explicitly resetting the indentation to 0. Zero just happens to be the thing that the indentation code computes from the parse context it gets after the parser has tried to recover from unrecognized syntax, which often leads to it discarding some of the rules it is currently trying to parse.
When pressing enter after the ; the indentation goes to column 0, whereas it should ideally stay at column 2. How about even if the mode doesn't know how to handle a given syntax, it'll fall back on keeping the indentation of the previous line (like when CodeMirror smartIndent = false) rather than always going back to column 0?