2021-02-20 12:24 PM
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 :)
Solved! Go to Solution.
2021-02-20 12:37 PM
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
2021-02-20 12:37 PM
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
2021-02-20 12:41 PM
OK, but I would like CubeMX to export tabs - or at least quad-spaces ;)
2021-02-22 2:50 PM
You can run this on the code after generation / before committing to version control:
2021-02-25 6:42 AM
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?
2023-11-09 11:43 PM
Two years later, and I still see people asking about this. Have you found a solution, @Fabian21 ?
2023-11-10 12:10 AM
No, not really. Have not been using CubeMX/CubeIDE lately.
2025-04-04 5:21 AM
In CubeMX --> Project Manager --> Code Generator --> User Actions --> After Code Generation, you can specify a script to perform custom tasks after code generation, e.g. to format the code.
2025-08-14 3:27 PM
Two questions.
When I started with STM32IDE, CubeMX was already integrated into it, so I've never used CubeMX as a standalone app.
Q1. If I were to run CubeMX in order to run a custom print-formatting script, would I need to run both programs?
Q2. Wouldn't a script operate on plain text, and therefor the lose color, bold, and italic information that CubeIDE provides in its printed output?
I hope the IDE maintainers will implement a tabless (spaces instead) print option.
2025-08-14 4:15 PM
> Q1. If I were to run CubeMX in order to run a custom print-formatting script, would I need to run both programs?
CubeMX generates text files. No formatting.
> Wouldn't a script operate on plain text, and therefor the lose color, bold, and italic information that CubeIDE provides in its printed output?
CubeIDE adds color syntax itself. It's not in the text file.
Wanting CubeMX to output a different syntax is a ridiculous request. Adapt. Formatting tools are easy to find. The output from CubeMX is reasonable--they can't possibly satisfy every code style out there as they all conflict with each other. Some like tabs, some not, some 2 spaces, some 4, some (shudder) 8. Some brackets at the end of the line, some on a new line. C will never have a code style that the majority of people agree upon. Just wasn't evolved that way.
One hotkey, Ctrl+Alt+Shift+F, and your file is formatted according to your rules. That is the solution. Not expecting everyone to bend to your rules.