Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help with astyle in vs2019 #39689

Closed
Pupsi-Mupsi opened this issue Apr 18, 2020 · 8 comments
Closed

Need help with astyle in vs2019 #39689

Pupsi-Mupsi opened this issue Apr 18, 2020 · 8 comments
Labels
Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Question> Answer me please.

Comments

@Pupsi-Mupsi
Copy link
Contributor

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!

@anothersimulacrum
Copy link
Member

anothersimulacrum commented Apr 18, 2020

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 lukamicoder/astyle-extension#17 (comment).

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.)

@Night-Pryanik
Copy link
Contributor

Night-Pryanik commented Apr 18, 2020

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).

@Night-Pryanik Night-Pryanik added the Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style label Apr 18, 2020
@KorGgenT KorGgenT added the <Question> Answer me please. label Apr 18, 2020
@Pupsi-Mupsi
Copy link
Contributor Author

Pupsi-Mupsi commented Apr 18, 2020

@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

@Pupsi-Mupsi
Copy link
Contributor Author

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

Any chance to assign a keyboard shortcut to this?

@CountAlex
Copy link
Contributor

CountAlex commented Apr 18, 2020

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.

@Pupsi-Mupsi
Copy link
Contributor Author

You are right!

@Night-Pryanik
Copy link
Contributor

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".

@Pupsi-Mupsi
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Question> Answer me please.
Projects
None yet
Development

No branches or pull requests

5 participants