Cataclysm-dda: Need help with astyle in vs2019

Created on 18 Apr 2020  Â·  8Comments  Â·  Source: CleverRaven/Cataclysm-DDA

Can someone help me with how to get astyle 3.1 up and running.
I'm new to visual studio 2019 and would very much appreciate any help!

<Question> Infrastructure / Style / Static Analysis

Most helpful comment

Any chance to assign a keyboard shortcut to this?

изображение

Go to Options -> Environment -> Keyboard. Type "astyle" to quickly find the commands. Use "Press shortcut keys".

All 8 comments

Disclaimer: I don't use VS, and I'm not on windows, but I've seen this before.

There is an astyle extension for 2019, but it is not on the marketplace like the 2017 version. You can either build it from their github repo (https://github.com/lukamicoder/astyle-extension/releases), or if you trust downloading random zips on the internet, you can grab it from here https://github.com/lukamicoder/astyle-extension/issues/17#issuecomment-537814439.

Alternatively, you can download astyle from it's website, and use this bat file to run it

echo off
cd Cataclysm-DDA
astyle --options=.astylerc --recursive src/*.cpp,*.h tests/*.cpp,*.h

(You store this one directory up from the git repo - alternatively, you can change the cd line, and use it wherever works.)

https://github.com/lukamicoder/astyle-extension/files/3684809/AStyleExtension.zip worked for my VS2019.

Install the plugin in the archive, go to Tool -> Options -> Astyle Formatter. Select Export/Import tab, then select msvc-full-features directory. This will apply settings in AStyleExtension-Cataclysm-DDA.cfg. After that, you can format the text with Edit -> Advanced -> Format Document/Selection (Astyle).

@anothersimulacrum
@Night-Pryanik

Thanks a lot. Worked fine!

Did some testing. Loaded a file and formated it with astyle without changing anything.
Is this supposed to like this? Example:
grafik

After that, you can format the text with Edit -> Advanced -> Format Document/Selection (Astyle).

Any chance to assign a keyboard shortcut to this?

After that, you can format the text with Edit -> Advanced -> Format Document/Selection (Astyle).

Any chance to assign a keyboard shortcut to this?

I don't remember exact actions for this but I was using link Night-Pryanik mentiones above, and settings for the plugin are set to make astyle reformatting on file saving.

You are right!

Any chance to assign a keyboard shortcut to this?

изображение

Go to Options -> Environment -> Keyboard. Type "astyle" to quickly find the commands. Use "Press shortcut keys".

Thank you very much. I'm closing this issue. Everything works fine! I tested astyle with the latest changes on #39471. Fingers crossed ;-)

Was this page helpful?
0 / 5 - 0 ratings