cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX generates code with spaces, but CubeIDE uses tabs

Fabian21
Associate III

Hi everyone,

when I export a project from STM32CubeMX (6.1.1) to the STM32CubeIDE (1.5.1), a project with double space indent is created. However, the CubeIDE uses Tabs. How can I fix that? Who uses double space indent anyway?

Thanks a lot :)

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

You can specify formatting rules for eclipse in Window -> Preferences -> C++ -> Code style -> Formatter

There you select one of bundled formatting styles or create your own.

If you prefer your own, export it and save the file outside of the eclipse workspace.

When you start a new project, import it back.

-- pa

View solution in original post

6 REPLIES 6
Pavel A.
Evangelist III

You can specify formatting rules for eclipse in Window -> Preferences -> C++ -> Code style -> Formatter

There you select one of bundled formatting styles or create your own.

If you prefer your own, export it and save the file outside of the eclipse workspace.

When you start a new project, import it back.

-- pa

Fabian21
Associate III

OK, but I would like CubeMX to export tabs - or at least quad-spaces ;)

You can run this on the code after generation / before committing to version control:

http://astyle.sourceforge.net

https://clang.llvm.org/docs/ClangFormat.html

Fabian21
Associate III

Not exactly what I had in mind... It makes working with CubeMX/CubeIDE a pain if I have to do so many steps to change a little thing.

I want CubeMX to export a proper formatted code, is that too much to ask for?

Two years later, and I still see people asking about this.  Have you found a solution, @Fabian21 ?

Fabian21
Associate III

No, not really. Have not been using CubeMX/CubeIDE lately.