cancel
Showing results for 
Search instead for 
Did you mean: 

How to do text alignment for TruStudio?

New.Fish
Associate III

I use STM32 workbench for previous project and TruStudio for new project, when I copy some source code to TruStudio, it is not align properly, is there any shortcut for TruStudio can do alignment easily?

1 ACCEPTED SOLUTION

Accepted Solutions
RomainR.
ST Employee

Hello Nickname3026​,

Under Eclipse IDE (like SW4STM32 or TrueStudio) you should configure style formatter like this:

Window -> Preferences -> C/C++ -> Code Style -> Formatter 

By default K&R profile is selected. With Tab size = 4 for indentation

You can create a new profile with your prefered settings.

Then if you want to indent correctly a source code, select all the file (CTRL+A) then right cliq and choose Source menu and Correct indentation (or directly with CTRL+I)

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5

I'd probably look under Tab or Editor settings.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Amel NASRI
ST Employee

Hi,

Instead of copying code, why don't you port your project to TrueSTUDIO?

If you open a project based on SW4STM32 with Atollic TrueSTUDIO, it will automatically ask you to convert current project to an Atollic TrueSTUDIO project.

You need to build the project after that to check if any update is required later (generally no update is required, but may be some include paths need to be checked).

Just pay attention to avoid long paths for project location, it may generate compilation errors.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

New.Fish
Associate III

Hi Amel,

I did a number of SW4STM32 projects, sometime I just copy a part of functions to TrueStudio.

Tab button can't alignment.

I try to google the shortcut for alignment in TrueStudio, but can't find it.

RomainR.
ST Employee

Hello Nickname3026​,

Under Eclipse IDE (like SW4STM32 or TrueStudio) you should configure style formatter like this:

Window -> Preferences -> C/C++ -> Code Style -> Formatter 

By default K&R profile is selected. With Tab size = 4 for indentation

You can create a new profile with your prefered settings.

Then if you want to indent correctly a source code, select all the file (CTRL+A) then right cliq and choose Source menu and Correct indentation (or directly with CTRL+I)

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

New.Fish
Associate III

Hello roman,

Your answer is what I required, many thanks.