AStyle Extension


An extension for Artistic Style.

(17) Review
Visual Studio
2013, 2012, 2010, 14
Download (21,477)
E-mail Twitter Digg Facebook
Add to favorites
Reviews (17)
Q and A (16)
Sign in to write a review
Sort by:

by CFTheDragon | July 16 2014

This plugin is exactly what I needed, a nice easy to use interface to AStyle. Works exactly how I want it. Not a bunch of frilly overhead, perfect.

by Adelost | May 10 2014

Made my life a lot easier.

by Mister Branch | November 13 2013

Exactly what I needed!

by SamuelMarks | November 05 2013

Thanks, much better than the old "AStyle" in external tools which I was using… that "Format on Save" option is perfect!

Easy to use and QUICK tool that does some automated 'stupid' tasks, so you don't have to do them. With the 'Format on save' option this tool now silently but efficiently improves the readability of the code.

by Predelnik | October 11 2013

Very useful, even though some features still could be added.

by Eifelzwerg | September 18 2013

Works very reliable. Great tool to fix up unreadable legacy code. My only wish would be an option to run a whole solution or at least project through astyle.

by mtommy | August 28 2013

Just what I needed!

by Farova | June 01 2013

Wonderful plug in. Works perfectly! Thank you very much for this, it has saved me lots of time I would have spent formatting my code. And the large amount of options allow me to match exactly the style of formatting I like to use.

Highly recommended to everyone!

by dbcfd | May 14 2013

Very easy installation and setup with VS2012. Had previously used the command line version, and the plugin is even easier to use, with all of the functionality.

I only wish there was a way to format all open documents, all in project, etc, but I think that may be a limitation of Visual Studio.

by catus | April 27 2013

Really useful one. But I'd love to have export/import settings so we can synchronize between our team members.

by 3ICE | February 17 2013

Works as advertised, but is slightly feature-poor. (Some AStyle features are missing from the GUI, with no ability to add them ourselves. See Q&A #4)

Recommendations for new users:
• Check the boxes you need. By default all checkboxes are off, so this tool does nothing. Some may see this as an advantage, others as an inconvenience.
(Tools → Options → AStyle Formatter → General → Settings)

• Add a shortcut key for it. By default this tool is invoked from the menu (Edit → Advanced → Format Document AStyle). Add a hotkey for and it'll be more convenient.
(Tools → Options → Environment → Keyboard → Edit.FormatDocumentAStyle)

by THERAOT | October 11 2012

Saves the day!

by casterle | October 02 2012

Thank you so much!

by Gravity-Well | September 20 2012

Excellent work!

by SetoKaiba | April 07 2012


by Aybe One | April 01 2012

Very good !!!


Sign in to start a discussion

  • Option to format changed lines only
    4 Posts | Last post October 28, 2014
    • Could you add an option to restrict "format on save" to fragments that have been edited, or added? This is important for code review when working in a team. Currently, examining a reformatted file on SVN, it is hard to tell what lines contain modified code, and which are simply whitespace changes or additional brackets. Visual studio provides information what lines were changed (marks them with a color) and you already have a function to format selection, so it should be relatively easy. What do you think about it?
    • I am not sure what you are asking for. Do you mean that when format on save is applied certain options (such as convert-tab, add-brackets, etc) should be ignored? Why don't you just disable those options then?
    • No. Let's assume that I work on a codebase that is shared with other programmers. Some use formatting tools and some don't. Astyle formats entire file, including lines I didn't change. So, it's impossible for other people to tell what I did because they see changes everywhere. So what I'm asking is an option to restrict Format-on-save only to lines that were changed or added.
    • One of the problems with that approach is that formatting selections only really works on code blocks, such as classes or methods. If only the changed lines are formatted these lines would be formatted out of context. The only way to prevent this is to format the surrounding method or class. This, however, would go beyond the scope of this extension.
  • AStyle GUI is not found
    6 Posts | Last post June 24, 2014
    • VS2012 + WIN7 32BIT, is OK
      VS2012 + WIN7 64BIT, Options → AStyle Formatter is not found, Edit → Advanced → AStyle Format is also not found, AStyle Extension has been installed, version is 2.3, please help me...TOT
    • Try running Devenv.exe /ResetSkipPkgs. More info about it here:
    • I have run the command,and VS2012 has been upgraded to Update4,but the question remains...
      I think this problem may be caused by the 64bit os...@_@
    • No, it has nothing to do with the 64 bit OS. That is what I've also been using for years. Try to uninstall the extension from visual studio and then delete the AStyle directory at %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\.  Then reinstall it and see that would fix it.
    • Sorry, I meant %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\
    • Sorry, that isn't AStyle's problem.
      I reinstall AStyle and VS2012 many times,but the problem still exists.
      I spend a lot of time to find the reason.
      Finally, I find that this problem is caused by the Visual Assist X. (Although VAX does not appear to have any problems...)
      AStyle is working properly after I reinstall VAX.
      Thanks for your help.:)
  • Formatting Bug
    2 Posts | Last post April 16, 2014
    • --add-brackets
      Currently, AStyle Extension is not adding brackets {} to non-bracketed one line conditionals if the conditional contains a nested conditional.
      if (true) if (false) return;
      turns into:
      if (true) if (false) { return; }
      instead of:
      if (true) { if (false) { return; } }
      Of all the bugs, this one is the most annoying, as far as annoyances goes.
    • You should report this bug to the authors of Artistic Style at
  • svn missing cs project file
    2 Posts | Last post April 09, 2014
    • when i pull out the source from svn and open the .sln file, VS2010 observes the cs project file is missing.  can you add it?  thanks.
    • You need to have the Visual Studio SDK installed to be able to open the project.
  • Need Help With a Problem
    1 Posts | Last post April 07, 2014
    • I am using AStyle on a VS2010 C++ solution with many file extensions including .idl and .inl. 
      I do NOT want AStyle to change the .idx, .inl extension files.
      Reason is, under my formatting rules, they are changed in such a way as to make them invalid.
      How can I tell AStyle to exclude certain extensions such as these?
      Thanks alot!
  • Update to astyle 2.0.4
    2 Posts | Last post November 25, 2013
    • Hi,
      That plugins is very useful especially the "format on save".
      However, is it possible to upgrade astyle to 2.0.4 to allow the new options like --attach-namespaces: ?
    • Version 2.3 includes Artistic Style 2.0.4 with all the new options available in the GUI.
  • Load AStyle Formatter Settings on Startup
    2 Posts | Last post November 06, 2013
    • Hi
      1) Is it possible to add a option, so that a specific .cfg file (file is stored in the same folder as the solution file) is loaded and used by opening a solution?
      2) And is it possible to add this behavior to projects, also, it is possible to add different formatting styles for each project in a solution?
    • In that case, you would only edit the current project's or solution's formatting style when you go to the settings. I would also have to add a global settings option. 
      It would be a fairly significant modification for a feature I am not sure how many people would actually use it.
  • Execute astyle on save option?
    5 Posts | Last post October 14, 2013
    • It would be great if the astyle VS plugin would support an execute-on-save option, just like Code Maid's 'Automatically run cleanup on file save'.
      I've used astyle from command line before on a gcc-make project where it was included as a build step.
      The current project is in Visual Studio 2010 (c++). I have searched for a solution (ie plugin or macro) to support automatic styling, but I have found no solution.
    • Good idea. I will add this feature to the next release.
    • Great, thanks in advance!
    • Version 2.2 has now been released with the Format on save feature.
    • Our team has it installed, works like a charm!
  • The latest version broke this extension's main functionality
    5 Posts | Last post October 11, 2013
    • Screenshot of error:
      I believe it ships a bad dll version of AStyle that relies on MSVCP110.dll which most users don't have yet:
      158 KB (162 304 bytes)
      0: <All Modules>	Valid: 	Delay: 
      1: MSVCP110.dll	Valid: No	Delay: No
      2: MSVCR110.dll	Valid: No	Delay: No
      3: KERNEL32.dll	Valid: Yes	Delay: No
      Total References: 4
      Invalid References: 2
      I built the latest AStyle.dll for myself in VS2010 and that got it back in working order (uses MSVCP100.dll now):
      157 KB (160 768 bytes)
      0: <All Modules>	Valid: 	Delay: 
      1: MSVCP100.dll	Valid: Yes	Delay: No
      2: MSVCR100.dll	Valid: Yes	Delay: No
      3: KERNEL32.dll	Valid: Yes	Delay: No
      Total References: 4
      Invalid References: 0
      Daniel "3ICE" Berezvai
      p.s.: I still want editable command line switches. I use the same settings for C++ and C#, but copying them over checkbox by checkbox is not comfortable work.
    • First time I ever try to use AStyle, getting this error as well. Not satisfactory.
    • Version 2.0 removes the dependencies and also adds an option to directly edit the command line.
    • You are awesome! I no longer use Visual Studio, but in case I ever do again, then installing this extension will be my first priority.
      Will the checkboxes update based on a parse of the custom command line I entered, or is this going to be an either-or setting. I mean something like this scenario: We can either use the GUI or the custom command line to change our settings, but not both at the same time. Is this assumption correct?
    • Correct. Using either option overrides the previous option used. 
  • Little suggestion
    3 Posts | Last post August 20, 2013
    • Extension is amazing and really helpful.
      I have a little bit of suggestion though, sometimes AStyle is not able to handle all the cases of code styling correctly, so formatting all the file isn't very good option in some cases. 
      That's great that there is an ability to apply formatting only for selection, but that spawns another problem, it's hardly valuable to format anything less than whole function, because sometimes it leads to wrong formatting at all. Selecting only current function and then formatting works great but it can be a little bit tiresome to select whole function manually all the time (especially in case of very big functions).
      For now I'm using this kind of a little bit crude macro in VS2010 to allow me format current function:
      Public Sub ApplyAstyleToCurrentFunction()
              Dim textSelection As TextSelection
              Dim codeElement As EnvDTE.CodeElement
              Dim textSelectionPointSaved As EnvDTE.EditPoint
              Dim textPoint As TextPoint
              textSelection = DTE.ActiveDocument.Selection
              textSelectionPointSaved = textSelection.ActivePoint.CreateEditPoint
                  codeElement = textSelection.ActivePoint.CodeElement(vsCMElement.vsCMElementFunction)
                  If Not (codeElement Is Nothing) Then
                      textSelection.MoveToPoint(codeElement.GetStartPoint(vsCMPart.vsCMPartHeader), True)
                  End If
              End Try
          End Sub
      But since in VS2012 ability to use macros were removed then maybe it would be useful to implement such thing in extension itself?
    • Good idea, it could possibly be beneficial to be implemented into this extension.  Although you just reinvented a wheel that has already been reinvented. Let me explain:
      ReSharper.Resharper_ExtendSelection: Ctrl-w will select the desired scope. May need to hit it several times.
      CodeRush Xpress has a similar feature: You can increase or decrease the scope of your selection with customizable keybinds. (Default is: "Num+")
      Generally I hit the "+" keybind 3-4 times and it selects my whole function. It goes like this: Object I'm editing → If block it's in → Loop that's (possibly) in → The entire function is selected. Handy.
    • Yeah I'm reinventing a lot of wheels these days I guess, that's just a way life is :) Still though since I code mostly in C++ I don't use stuff you mentioned, maybe some fancy extension like Visual Assist have some similar but sadly I don't use it either. 
      Actually thing is, the stuff like this isn't very hard to code in the first place, I just have to do some weird stuff about selecting the designated text part (probably not optimal and very strange), but inside extension it could be done a lot easier and clearer, I believe)
1 - 10 of 16 Items