Special comments that unlock certain Rubberduck tools.
More than just comments, annotations provide Rubberduck with actionable metadata that is used to support Rubberduck-specific features, such as unit testing, or custom folers in the Code Explorer toolwindow
A specific subset of annotations work in conjunction with inspections and quick-fixes, to surface hidden module and member attributes that are otherwise only editable by exporting the module and editing in a text editor, then re-importing the modified module into the project: Rubberduck automates this, and that gives you full control over how your class modules behave.
Because depending on its location it could be impossible to tell whether the target of a particular is the module or its first procedure, annotations are divided in two main categories: module annotations that go in a module’ declarations section, and member annotations that go above a procedure’s signature... and this is why annotations @Description
and @ModuleDescription
had to be separate.
This tab lists all items found in the .xml documentation assets from the latest pre-release build. To modify this content, a pull request must be merged into the [next] branch.
@DefaultMember annotation, indicates that the member should have a VB_UserMemId attribute value (0) making it the default member of that class. Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@Description annotation, indicates that the member should have a VB_Description attribute to provide a docstring. Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@EntryPoint annotation, marks a standard or document module member as an entry point procedure that is not intended to be referenced directly from the code.
@Enumerator annotation, indicates that the member should have a VB_UserMemId attribute value (-4) making it the enumerator-provider member of that class, enabling 'For Each' iteration of custom collections. Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@ExcelHotkey annotation, indicates the presence of a VB_ProcData.VB_Invoke_Func metadata attribute value that maps a hotkey to a standard module procedure ("macro"). Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@Exposed annotation, indicates the presence of a VB_Exposed module attribute value (True) to make a class visible to a referencing project (classes are otherwise private by default). Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@Folder annotation, used by Rubberduck to represent and organize modules under a custom folder structure.
@Ignore annotation, used by Rubberduck to filter inspection results at member and local level.
@IgnoreModule annotation, used by Rubberduck to filter inspection results module-wide.
@IgnoreTest annotation, used by Rubberduck for skipping a particular test when running the tests of a test module.
@Interface annotation, marks a class as an abstract interface; Rubberduck can use this valuable metadata in its code analysis.
@MemberAttribute annotation, indicates the presence of a hidden member attribute; allows specifying arbitrary VB_Attribute for members. Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@ModuleAttribute annotation, indicates the presence of a hidden module-level attribute; allows specifying arbitrary VB_Attribute for modules. Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@ModuleCleanup annotation, marks a procedure that Rubberduck executes after all tests of a module have completed.
@ModuleDescription annotation, indicates the presence of a VB_Description module attribute value providing a docstring for the module. Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@ModuleInitialize annotation, marks a procedure that Rubberduck executes before running the first test of a module.
@NoIndent annotation, used by the "indent project" feature to ignore/skip particular modules when bulk-indenting.
The annotation type Rubberduck uses for comments that correctly parse as annotations, but weren't recognized as such. Since this is not actually an annotation, it has no valid target.
@Obsolete annotation, marks a procedure as "obsolete". Rubberduck inspections can then warn about code that references them.
@PredeclaredId annotation, indicates the presence of VB_Predeclared module attribute value (True) that defines a default instance for the class, named after that class. Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.
@TestCleanup annotation, marks a procedure that Rubberduck executes once after running each of the tests in a module.
@TestInitialize annotation, marks a procedure that Rubberduck executes once before running each of the tests in a module.
@TestMethod annotation, identifies a procedure that constitutes a unit test.
@TestModule annotation, marks a module for unit test discovery.
@VariableDescription annotation, indicates the presence of a VB_VarDescription attribute value providing a docstring for a module-level variable or constant (not local variables). Use the quick-fixes to "Rubberduck Opportunities" code inspections to synchronize annotations and attributes.