Auto Format in Creator

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RyWi_4724536
Level 3
Level 3
10 replies posted 10 questions asked 10 sign-ins

I saw this was asked a few years ago with no solution. Is there a way to auto format c code in creator? As in something to make all of the indentations line up and look nice.

0 Likes
1 Solution

Hi RyWi_4724536,

Adding to Kenshow-san's response, PSoC Creator does not correct the indentation.

Considering your example, when you type if(x>0){ and press Enter, PSoC Creator auto indents the code as shown -

pastedImage_4.png

However, if you have to correct the indentation, then you will have to do it manually.

How do you indent/uindent a block of code?

You can select the block of code that you want to indent and press Tab. Shift+Tab unindents the block of code.

Thanks and Regards,

Rakshith

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
4 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi RyWi_4724536​,

Can you please point me to the discussion that you are referring to? It might help me understand your request better.

There is an automatic indentation feature in PSoC Creator that provides indentation after an open bracket etc. You can also indent/unindent a block of code.

However, if you want the indentation of the entire source file to be fixed automatically, then, unfortunately, that feature is not available in PSoC Creator.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes

Hi Rakshith

I was hoping for indenting the whole file or a selection.

Say the code is:

if(x>0){

x=0;

}

I'd want it to change to:

if(x>0){

     x=0;

}

It doesn't sound like Creator can do that though....

How do you indent/uindent a block of code?

0 Likes
Kenshow
Level 8
Level 8
Distributor - Marubun (Japan)
50 solutions authored 25 solutions authored 10 solutions authored

Hello,

I couldn't find that feature in Creator, but Modus Toolbox 2.1 has it.

Window > Preferences > C/C++ > Editor > SaveActions, and check "Format source code"

Regards,

Kenshow

Hi RyWi_4724536,

Adding to Kenshow-san's response, PSoC Creator does not correct the indentation.

Considering your example, when you type if(x>0){ and press Enter, PSoC Creator auto indents the code as shown -

pastedImage_4.png

However, if you have to correct the indentation, then you will have to do it manually.

How do you indent/uindent a block of code?

You can select the block of code that you want to indent and press Tab. Shift+Tab unindents the block of code.

Thanks and Regards,

Rakshith

Thanks and Regards,
Rakshith M B
0 Likes