|
| ||||||||||
InstallationThe download includes an installer. Just quit all running instances of Visual Studio, run the installer executable, and hit the install button. This installer simply copies a few files onto your PC (in your My Documents folder). The next time you run Visual Studio, the Addin will auto load and place a new AtomineerUtils menu on the Tools menu. Note that the installer must be copied onto your computer's hard drive to be run. Due to the executable security features in .net 2.0 it may fail if an attempt is made to run it directly from a LAN folder. You can link the Addin commands to keypresses as follows:
Multi-user Installation
In addition, AtomineerUtils uses a 'search path' when loading preferences/rules, which allows you to place your customisations into source control. See below for details. Disabling or Uninstalling AtomineerUtils AtomineerUtils can be temporarily disabled in Visual Studio by choosing the Tools > Add-in Manager menu item, and un-ticking the checkbox to the left of the AtomineerUtils add-in. To uninstall AtomineerUtils, quit all running instances of Visual Studio. Now open the installation folder (this is usually the 'My Documents' folder - you can run the installer to be reminded of the install location). The install folder contains 'Visual Studio 2005', 'Visual Studio 2008', and 'Visual Studio 2010' sub-folders, each of which contains an 'Addins' folder. Delete the 'AtomineerUtils.Addin' file from each of these Addins folders. You may then delete the Visual Studio 2008\Addins\AtomineerUtils folder to remove all program files and your rules and preferences. Command Reference
Command: Add Doc Comment
This command creates or updates a DocXml, Doxygen or Javadoc-compatible description comment block for C#, C++/CLI, C++, C, or Visual Basic code. Usage
...and execute the command. Description
For example, the following function documentation headers were completely auto-generated. (Note that these examples are in the default AtomineerUtils style. The style is highly configurable (see some examples of different styles). ////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Event handler. Called by the TaskListCtrl for KeyDown events. </summary>
///
/// <remarks> Jason Williams, 12/04/2009. </remarks>
///
/// <param name='sender'> Source of the event. </param>
/// <param name='e'> Event information. </param>
////////////////////////////////////////////////////////////////////////////////////////////////////
void TaskListCtrl_KeyDown(object sender, KeyEventArgs e)
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Initialises the file buffer. </summary>
///
/// <remarks> Jason Williams, 12/04/2009. </remarks>
///
/// <exception cref="NotImplementedException"> Thrown when the requested operation is
/// unimplemented. </exception>
///
/// <param name="fname"> Filename of the file. </param>
/// <param name="buffSize"> Size of the buffer. </param>
/// <param name="resetCache"> true to reset cache. </param>
////////////////////////////////////////////////////////////////////////////////////////////////////
public void InitFileBuff(string fname, int buffSize, bool resetCache)
{
throw new NotImplementedException();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Gets or sets the foreground colour. </summary>
///
/// <value> The colour of the foreground. </value>
////////////////////////////////////////////////////////////////////////////////////////////////////
public Color FgColour { get {}; set {} }
For more examples of the auto-generated documentation text, see: DocXML format comments and Doxygen format comments. Generating new documentation For example, AtomineerUtils Pro provides:
The add-in uses some very powerful systems for generating the documentation automatically:
[*] Please note: The three features marked above rely on the Visual Studio Intellisense system. If this is disabled, your documentation is not in DocXml format for use by Intellisense, or the intellisense information is not available (e.g. in C code, and sometimes in C++) then AtomineerUtils will be forced to fall back to its regular auto-documentation generation algorithm. All of the above is configurable - The style of blocks, the entries they contain and their ordering, indentation styles and word-wrap, and use of blank lines (both within the comment and between the comment and any surrounding code). Updating existing documentation comments In addition, the block will be (optionally) reformatted to keep it tidy:
'Deleted' entries ///### <param name='value'> This parameter has just been deleted</param> This preserves any text from these entries in case you wish to re-use it anywhere else (e.g. a renamed parameter). If you execute the Doc Comment command a second time, any such 'deleted' lines will be automatically removed to save you having to manually clean up the comment. Additional tips:
Changing the comment layout style and generated documentation text The style of the comment blocks is quite configurable. High-level settings can be changed using the Atomineer Utils Options (available from the Atomineer.Utils menu in Visual Studio), while lower level improvements to the automatic documentation can be made by editing the Atomineer Auto-Documentation Rules XML file. See the Preferences and Doc Comment Rules sections below for details. Converting documentation from an old format As this is a relatively rarely used option, it must be manually configured by opening the AtomineerUtils Prefs.xml file (in your install folder, usually My Documents\Visual Studio 2008\Addins\AtomineerUtils) and adding the following elements to the <DocComment> section: <Alt-Separator value="/** " /> <Alt-LineHeader value=" * " /> <Alt-SeparatorB value=" */" /> You can set any text for the Separator (top line of the comment block), SeparatorB (bottom line of the comment block) and LineHeader (prefix for all lines within the block). If the separators and/or line prefix are not used, you must set value="(None)" The comments can be read from DocXml or Doxygen format, and will be converted into your configured 'primary' format (whether that is Doxygen or DocXml. If the format is the same, then it will simply be converted from an old block style to a new style). The standard tags (summary/brief, returns/return, seealso/sa etc) will be converted automatically as required, including embedded tags like c/see. Any custom tags used in your old format will simply be treated as embedded text appended to the previous entry, unless they match a custom entry tag that you have added to your comment Templates in rules.xml - if a matching template entry tag is found, the old comment data will be converted to the new documentation style and inserted into the final block as dictated by that template. In addition, Rules.xml contains a new section, <Conversions>, which tells AtomineerUtils how to convert the entries it finds. This can:
For full details, see the comments in the Conversions section of the rules. If an 'incorrect' entry is converted (such as a param or exception entry that describes a parameter or exception that is not present in the code), the entry will be converted correctly, but then added at the bottom of the new comment with '###' prepended ('deleted' entry), just as would happen if you removed that param/exception and updated an existing comment. If unwanted, just execute the DocComment command a second time to clean away these 'deleted' entries. Note that if the old comment format diverges too far from what AtomineerUtils expects (such as using Doxygen aliases or custom DocXml elements not mentioned in the Conversions rules), the conversion may not work so well - you may need to 'tidy up' the comment (manually or perhaps using a Macro script) before/after applying the AtomineerUtils conversion. For example, the following Doxygen comment uses the alternate format described by the prefs XML above, with Doxygen entries: /** * @brief This is the brief description * @returns true if it feels like it * @param exampleParam An example parameter. * @date 15/04/2010 * @author Jason */ ...and it is converted to the following DocXML (in this case, using the default AtomineerUtils format, with the entries rearranged in the order dictated by the default template): //////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> This is the brief description. </summary> /// <author> Jason. </author> /// <date> 15/04/2010. </date> /// /// <remarks> Jason Williams, 16/04/2010. </remarks> /// /// <param name="exampleParam"> An example parameter. </param> /// /// <returns> true if it feels like it. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// Note that the author and date are recognised tags and thus preserved in the resulting comment - but if these are not set as 'legal' entries in your templates, they can be removed by simply executing ths DocComment command a second time to update the new comment. (Note also that the 'remarks' was not supplied, so a new auto-generated entry is added that records the author/date of the conversion). However, as you can see, AtomineerUtils does the bulk of the conversion work for you. Command: Document all in this scopeThis command searches a file, namespace, class, interface, struct, or enum scope and applies the Add Doc Comment command to each major code element within it. (Note that it does not recurse into nested (child) scopes (so you may have to run it several times to document a whole file if it contains several classes), and it does not yet handle all possible code elements (constants/variables, or header file declaraitons being the primary examples that I have yet to add support for) Usage
To document all code elements within a specific scope, place the cursor in the declaration that introduces the scope (i.e. somewhere in the line with the 'namespace', 'class' (etc) text) and execute the command. Description
This can be used in the following ways:
After executing this command it is highly recommended that you read through and update the resulting documentation to be sure that it is complete, correct and accurate. Command: Create C# or C++/CLI Property, Create C++ Access Methods
C++: Creates simple inlined "Get" and "Set" methods to access a member variable, making it much quicker and
easier to make members private and properly encapsulate your class data. Usage Description C++: Get and Set methods will be created, and inserted into the document above the preceeding "public/protected/private:" tag. For known simple types (int, float, etc) the accessors will pass by value. For unknown types, it assumes complex types (struct/class) and will pass by const-reference. The names used for the getter/setter can be configured in the preferences. C++/CLI: A property is defined, and inserted into the document above the preceeding "public/protected/private:" tag. C# 2005: A property is defined, and is inserted immediately above the member variable declaration. The protection level for the variable will be changed to private, and the Property will use the protection level previously assigned to the variable (or public if it was private). It also adds attributes to improve debugging of the property (stops the debugger single-stepping into the property get/set function, and hides the member variable in the Locals window so that you don't end up with the property and the member variable both being displayed alongside each other). (A using System.Diagnostics; will be automatically added as well if required) C# 2008/2010: When executed on a member variable, it is converted into an auto-property. When executed on an auto-property, it is converted into an explicitly implemented property with a backing field. The backing field will use the variable naming style configured in the preferences. You can convert from a member variable to an explicit implementation by just executing the command twice in succession. A preference is provided to allow you to set a template for the backing field naming style. For an auto-property called 'MyProp', the default (a blank prefix) is to generate a backing field 'myProp'. With a template specified, other styles (e.g. '_MyProp', 'm_MyProp' 'mMyProp', '_Member_MyProp_' can be generated. Note that debugger attributes are not added in VS2008/2010, as these IDEs provide much better debugger stepping facilities, so the attributes are no longer necessary. Before (C++)public: private: int mInteger; MyClass mComplexClass;After (C++) public:
int GetInteger(void) const { return(mInteger); };
void SetInteger(int Integer) { mInteger = Integer; };
const MyClass &GetComplexClass(void) const { return(mComplexClass); };
void SetComplexClass(const MyClass &ComplexClass) { mComplexClass = ComplexClass; };
private:
int mInteger;
MyClass mComplexClass;
After (C++/CLI) public:
property int Integer
{
int get() { return(mInteger); }
void set(int value) { mInteger = value; }
}
property const MyClass& ComplexClass
{
const MyClass& get() { return(mComplexClass); }
void set(const MyClass& value) { mComplexClass = value; }
}
private:
int mInteger;
MyClass mComplexClass;
C# (VS2005) public int Integer
{
[DebuggerStepThrough] get { return(mInteger); }
[DebuggerStepThrough] set { mInteger = value; }
}
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private int mInteger;
C# (VS2008/2010)
// Original variable
private int mSpeed;
// After one execution, an auto-property
public int Speed { get; set; }
// After the second execution, an explicit property with backing field
public int Speed
{
get { return(mSpeed); }
set { mSpeed = value; }
}
private int mSpeed;
Command: Implement/Declare C++ method
(C++ only)
Usage Description
When executed in a source (.cpp) file: For this command to work, the .cpp and .h file must have a common filename, and both be part of your Visual Studio Project. Header declaration: // Creates a new Thingummy containing the required number of Wotsits Thingummy *CreateThingummy(CreateInfo *pInfo, int NumWotsits = 12) const; Resulting source file implementation (with doxygen-style comment) ////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn Thingummy *MyClass::CreateThingummy(CreateInfo *pInfo, int NumWotsits)
///
/// \author Jason Williams
/// \date 6/6/2005
///
/// \brief Creates a new Thingummy containing the required number of Wotsits
///
/// \param pInfo If non-NULL, the information
/// \param NumWotsits The number of wotsits
///
/// \retval NULL if it fails, else
///
////////////////////////////////////////////////////////////////////////////////////////////////////
Thingummy *MyNamespace::MyClass::CreateThingummy(CreateInfo *pInfo, int NumWotsits) const
{
return(NULL);
}
Command: Open C/C++ Source or HeaderWhen executed in a C/C++ source/header file, opens the matching header/source file. Usage Description Command: Hide DocComments using OutliningUses Visual Studio's Outlining feature to hide all DocXml Comments in your code. Usage Description Command: Hide Attributes using OutliningUses Visual Studio's Outlining feature to hide Attributes in your C# code. Usage Description Command: Copy As Text
Copies selected text onto the clipboard in a simple, clean format for use in other programs. Usage Description This command addresses all of these issues by copying the selected text in your document to the clipboad as plain text. It (optionally) strips unnecessary indentation from the block, and (optionally) converts tabs into spaces. Note that for the formatting to appear correct in the pasted text, you must display it using a monospaced font (e.g. Courier New). Command: Word wrap comment
Word-wraps the text in a comment block. Usage Description Other Menu ItemsAtomineerUtils Options... Help and User Guide... Check for updates... About AtomineerUtils... SuppressUI and AllowUI commandsSuppress user-interface prompting to allow execution from a Visual Studio macro. Usage Just include the following commands at the start and end of your macro:
DTE.ExecuteCommand("Atomineer.Utils.Commands.SuppressUI")
... your macro here ...
DTE.ExecuteCommand("Atomineer.Utils.Commands.AllowUI")
PreferencesThe AtomineerUtils => Options... command will show a preferences window.
This allows you to choose from a number of options to tweak the commands to operate
as you want them to:
Doc Comment - General settings tab
In addition, these Doxygen-specific options can be set:
Doc Comment - Border Style tab This section controls the border of the doc comment. There are two standard comment styles that Visual Studio will recognise (it will syntax colour them and extract them as documentation comments for intellisense). Doxygen also recognises and parses these formats, so they are the recommended base style:
AtomineerUtils Pro supports these formats (and more) by allowing you to define the format of optional first and last lines (the top and bottom 'separator' lines) and an optional prefix that is used on every line in the body of the comment. These can be almost anything you want, as long as they meet these primary requirements:
Any of these can be set to (none) to remove them from your comment style entirely. The default format is the 'triple slash' format with ////////// separator lines to demark the comment block, but several other common and demonstration formats are provided in the combo boxes, or you can type in a custom string. Note that the top separator can now be a multi-line block (using \n in the text to denote newlines). If you use this, you must use a /** ... */ comment style for AtomineerUtils to be able to correctly parse and update existing comments. Within this top separator, you can also optionally use %type% to embed the type of the code element (Class, Method, Property, Constructor, etc) and %name% to embed the code element's name in this separator section. A three-line demo format is available to trial this form. Lastly, AtomineerUtils can optionally enforce a specific number of blank lines above and/or below each DocComment to ensure a consistent style throughout your code with a minimum of effort.
Doc Comment - Entry Style tab
Advanced Customisation tab At the top of the tab, you may set the Rules Search Paths, which contol where AtomineerUtils will look for customisations, allowing you to store these additional files in Source Control ort a shared network drive. Below this are a number of buttons. Each allows you to export one section of the rules to a custom file, and then edit it. (By adding customisations in this way, the AtomineerUtils installer can overwrite the default rules without losing your custom rules). The first time you click each button, the rules section will be exported to a separate file in the first folder listed on your Rules Search Path. If the search path is not set, they will be exported in the AtomineerUtils install folder. Once customised, the button text will turn green and clicking it will simply open the custom rules for editing. Each customisation file contains a lot of XML comments and examples that show you how to write your own rules to augment the default AtomineerUtils behaviour. The last section of this Tab allows you to move the storage location for the block comment style preferences into a set of custom files. These preferences will continue to be edited as normal in the preferences dialog, but will now be stored on your Rules Path, making it possible for them to be held under Source Control. You can move these files anywhere you like as long as they can be found on the Rules Path you set at the top of the Tab. More information on custom templates and rules can be found below.
Live Preview pane This section (at the bottom of the three Doc Comment tabs) shows an example comment, illustrating the sort of style you can expect from the settings you have chosen. It updates live as you change the preferences. Note that this is a guide only, but it will give you a fairly reasonable idea of how the real comments will appear.
Source Outlining tab
A similar set of options are available when outlining Attributes
Misc tab 'Menu Items' allows you to hide menu items for AtomineerUtils commands that you don't use. Why clutter the VS menus with options you never use? This just helps to keep the user interface clean and useful. 'Copy as Plain Text command' allows you to control the format of the text that Copy As Text will place on the clipboard.
'Create Property/Accessor command' allows you to set a (C#, C++) member variable and (C++) method style templates. These are used in the following ways:
The core of the templates is the special text 'VarName' which is a placeholder for the actual variable name. This may have an arbitrary prefix and/or suffix. In addition, the casing style (VarName or varName) controls the casing of the result. The combo boxes supply predefined examples, or you can type your own custom templates in instead. 'Implement/Declare C++ method' command allows you to configure aspects of the implementation behaviour:
Doc Comment Rules and TemplatesThe DocComment output of AtomineerUtils is extremely configurable via a set of simple Xml files. Locate the default file in your "My Documents" folder (or the install location you chose in the AtomineerUtils installer - just run the installer again to see where it is installed) under: My Documents\Visual Studio 2008\Addins\AtomineerUtils\Rules.xml The rules are very simple yet powerful. Usage of the rules is heavily documented within this Xml file to allow you to augment the rules for yourself. The rules fall into three main groups:
To add your own custom rules, you could edit Rules.xml directly, but this would mean that you would need to merge your edits every time you upgraded AtomineerUtils. To avoid this, you can customise the rules more easily, by providing your own rules in additional xml files. Every section of the rules.xml can be saved as a new XML file of the same name, and the rules it contains will be executed before the rules in rules.xml. The full set of customisation files that can be added is:
For convenience, the AtomineerUtils Options dialog provides buttons that will create these files for you automatically, and open them for editing. The files contain a lot of comments and examples that will show you how to write custom rules of your own. The file contents should be in exactly the same format as the corresponding section of rules.xml. For example, you can augment the method documentation with a Methods.xml containing the following: <?xml version="1.0" encoding="utf-8"?> <Methods> <If name="SelfDestruct" desc="Starts a 5-minute countdown before the computer explodes."/> </Methods> Keeping custom preferences and rules in Source Control If you augment the rules, please consider emailing me your updated rules file for possible inclusion into following releases. | ||||||||||
| Copyright © 1996-2010 Atomineer. All Rights Reserved. Contact us |