QtCreator (latest as of 116-26) issue with indentation
-
If you have a function with:
void someFunction(bool condition) { if(condition) for (stuff) for (more stuff) some.single.line.operation(); }...in the next function, ONLY when refactoring has hadded the function itself, the auto-indent will be somewhat incorrect....
someOtherFunction(bool something) { if (something) ^ ---- indentation starts here with auto-indent }So far, this ONLY happens when refactoring has added "SomeOtherFunction", If I REMOVE the function, or make changes to the previous function (anything that forces a re-read of the file or the reset of the indenter's count), things work as expected from that point on.
So again, this is only when adding a refactored function after such a function. This is about all I was able to narrow down and it seems to only do this sometimes. If I figure out any way to refine this to where it happens 100% of the time, I'll annotate that on.
The current workaround that I use is to just cut and then paste the refactored function back into the code to ensure the autoindenter has whatever counts it keeps accurate as possible.
As for the specific refactoring that I used here, it was the refactor that adds a function body from the CLASSNAME.h file:
... in classname.h ...
void SomeOtherFunction(bool something); ^--- R-click and select refactor->generate function in .cpp fileWhich causes the function to be put into classname.cpp, where the result is as it is shown in the snippet above this one.
Waiting for the parser to update everything (syntax highlighting updated and applied, everything gets linted) and do not any parsers turned off in this case does not seem to change the outcome.
My suggestion is maybe fire whatever event is triggered when text is changed by the user.
As an example, disabling signals while updating a text box and re-enable them afterwards to prevent the text box from firing signals as if the user had changed the text is often used.
This may or may not be the case here, but surely it is something similar to that. In which case there is a possible solution, were the developers ever at a point where they can address this:
It may be that there is a need to fire some event or call some function that is a result of that event being fired, in order to update the autoindent's counter or positioning at that point in the document.
I guess the question I am asking is this:
Is there currently any setting anywhere that would affect (or fix) this that I am overlooking?As Qt Creator has many settings, and some settings are only reachable via editing textual configurations or even creating files that didn't exist in the first place. So, if there is such a setting I'd be grateful to know what it is. If not, that's fine. Just wanted to reach out and let you know of my findings.
Thank you for listening!