Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Possible to make snippet that converts comments?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Zeblote
Tomato Guru

183 Posts

Posted - Oct 05 2018 :  2:10:49 PM  Show Profile  Reply with Quote
Is it possible to make a VA snippet that turns

/** stuff */

into

/**
 * stuff
 */

?

Zeblote
Tomato Guru

183 Posts

Posted - Oct 05 2018 :  2:26:20 PM  Show Profile  Reply with Quote
Nvm, turns out placing the cursor right before stuff and pressing return does this already.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Oct 06 2018 :  08:22:57 AM  Show Profile  Reply with Quote
Which IDE are you using? If you are using VS2017 you might want to look into the C++ formatting options the IDE offers. You can even use a clang format file, which will give you quite a lot of control on how code is formatted, once you get the rules set up as you want them.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Oct 06 2018 :  09:20:55 AM  Show Profile  Reply with Quote
I've actually tried to use a clang format file with VS before, but did not manage to get it to do anything. It acts as if the file doesn't exist, even though it's in the project folder and added to the solution like the instructions say. VS support is not being helpful either, guess that's expected when using the community version.

...I'm going kinda off topic here..
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Oct 06 2018 :  09:28:23 AM  Show Profile  Reply with Quote
Not entirely off topic, since this is still about code formatting.

I have clang format doing things here, I am using VS2017, currently version 15.8.4 on this machine, but it's now due for an update. The clang file is called ".clang-format", have fun creating that file in Windows I ended up naming the file ".clang-format." in Windows Explorer, at which point Windows removed the trailing dot, leaving me with just the leading dot.

The file content is:

# child level Clang Format file
BasedOnStyle: LLVM
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
UseTab: Never


the file is NOT added to the solution, but it is in the same directory as code files I want formatted with these rules. It also works for sub-directories, but not parent directories. Also make sure Clang format is Enabled in the IDE C/C++ Formatting settings, and that you then trigger a reformat command in the code file once the clang format file is saved out.

zen is the art of being at one with the two'ness
Go to Top of Page

Zeblote
Tomato Guru

183 Posts

Posted - Oct 06 2018 :  10:13:02 AM  Show Profile  Reply with Quote
Hmmmmm now I'm wondering if there might have been a bug in VS 15.8.5, because I just tried to use your file on a new project and *it works*! :D
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Oct 08 2018 :  06:16:25 AM  Show Profile  Reply with Quote
Once I pinned down the required steps, this did just work for me. But finding those steps took a little bit of searching and sorting out.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000