Author |
Topic |
|
Zeblote
Tomato Guru
183 Posts |
Posted - Oct 05 2018 : 2:10:49 PM
|
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
|
Nvm, turns out placing the cursor right before stuff and pressing return does this already. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Oct 06 2018 : 08:22:57 AM
|
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 |
|
|
Zeblote
Tomato Guru
183 Posts |
Posted - Oct 06 2018 : 09:20:55 AM
|
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.. |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Oct 06 2018 : 09:28:23 AM
|
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 |
|
|
Zeblote
Tomato Guru
183 Posts |
Posted - Oct 06 2018 : 10:13:02 AM
|
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 |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Oct 08 2018 : 06:16:25 AM
|
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 |
|
|
|
Topic |
|