Skip to main content
New.Fish
Associate III
September 3, 2018
Solved

How to do text alignment for TruStudio?

  • September 3, 2018
  • 5 replies
  • 2162 views

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?

This topic has been closed for replies.
Best answer by RomainR.

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)

5 replies

Tesla DeLorean
Guru
September 3, 2018

I'd probably look under Tab or Editor settings.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Amel NASRI
Technical Moderator
September 4, 2018

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
New.FishAuthor
Associate III
September 19, 2018

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.
RomainR.Answer
ST Employee
September 19, 2018

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
New.FishAuthor
Associate III
September 20, 2018

Hello roman,

Your answer is what I required, many thanks.