2

I'm using the Eclipse C/C++ formatter and run into an issue where it removes indents on line wrapping on the second save. For example I'll write some code:

int array[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

It'll then format it to (exaggerated line limit):

int array[] = {1, 2, 3, 4,
        5, 6, 7, 8, 9};

I'll then change something else in the file and format again. It now removes the line wrapping indentation on the original, unchanged code:

int array[] = {1, 2, 3, 4,
5, 6, 7, 8, 9};

I've tried messing with the settings but can't find what could stop it. I'm expecting it to stay line wrapped with the indentation on wrapped lines (what's seen after the first formatting). I don't want to use the "on/off tags" as i think they're bulky. Is there an option in the formatter that can stop this?

For clarification I'm using STM32CubeIDE version 1.18.0, and using a modified K&R [built in] profile for the formatter, but it looks like the issue is in the unmodified profile as well.

2
  • 1
    Including software version numbers is good and useful. Commented May 15 at 15:37
  • 1
    The formatter settings might also be relevant. Can you show a minimal reproducible example? Commented May 15 at 20:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.