Trim trailing whitespace on save?

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

cross mob
JoBr_1593366
Level 5
Level 5
100 sign-ins 50 questions asked 100 replies posted

Is there any way for PSoC Creator to trim all trailing whitespace when saving a file?  This is an option in editors like Spyder, for instance:

JoBr_1593366_0-1619805327189.png

I spend way too much time dealing with merge conflicts etc in git history from this junk at the end of lines.

0 Likes
1 Reply
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

JoBr,

I do not believe there is such a feature intrinsic to Creator.

However, the "Build Settings" dialog allows for you to declare "Pre Build" and "Post Build" execution commands.

Therefore either before (Pre) or after (Post) the Build phase you can install your own executables such as a batch file.

For example:

To trim end-of-line whitespace before the build you can create a Pearl script to perform this task in the "Pre Build"

To play a sound at the end of a build you can add a batch file to play the desired sound in the "Post Build".

 

I've used this feature to great effect when I wanted to move the executables to another directory for easier access.

 

Len
"Engineering is an Art. The Art of Compromise."