cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube indent using 2 spaces, How can I change it to 4 spaces?

Microstar
Associate III
Posted on March 27, 2018 at 05:29

exp:

void function(void) {

  int cubemode;

}

void function(void) {

    int iexpect;

}

#indent
14 REPLIES 14
Edimahler
Associate III

BTW: Does anybody knows, where to find the template files of CubeIDE in order to edit them using the Powershell way mentioned above?

BDinh.1
Associate II

Here is my instructions, worked well for me,

# find your STM32CubeMX.jar, make backup if necessary
find /opt/st/stm32cubeide STM32CubeMX.jar
 
# copy to temporary directory
cp STM32CubeMX.jar /tmp/test
 
# download Java Jar explorer and decompiler
https://github.com/Col-E/Recaf
# use recaf to navigate to com/st/microxplorer/codegenerator/CodeEngine.class
search for replace("#t", "  "), right click to the containing function "cleanCode", find for string "   ", change to "    "
 
# save the new jar file by File > Export Program
# close recaf, double check by reopen new jar file and confirm #t is now 4 spaces.
 
# restore new STM32CubeMX.jar to the original location

Check out my pre-patched cubemx here:

https://github.com/jetacpp/stm32cube_patch.git

NRatz.2
Associate II

Found it. In Windows > Preferences > General > Editors > Text Editors

Check "Insert spaces for tabs"

DBart.12
Associate

Hey, ST, any way to add a simple option in CubeMX to toggle that?