Code Library Options

Top  Previous  Next

 VS   VB6   VBA 

The Code Library section of the Personal Options tab allows you to maintain the code templates of your personal code library (there is also a team code library in the Team Options tab), to be used by the Code Library feature:

OptionsPersonalCodeLibrary

There is a root folder (that cannot be removed or renamed) for each supported language or technology.

You can:

  • Create (nested) folders inside each root folder (with the New Folder... button).
  • Create code templates (with the New... button).
  • Rename folders (with the Rename... button).
  • Delete folders (with the Delete... button).
  • Edit code templates (with the Edit... button).
  • Delete code templates (with the Delete button).
  • Export code templates to a file (with the Export... button), to be imported on another computer, or to move code templates between the team code library and the personal code library.
  • Import code templates (with the Import... button), either from a file or from Visual Studio code snippets.

Also, you can add the selected text in a code window to a new code template in the Code Library using the Add Selection To Code Library (Personal/Team) entries on the context menu.

To create a code template you use the following window:

CodeTemplate

In this window you enter the following properties:

  • Description: a text describing the code template.
  • Template Text: the actual text of the code template. Using the Insert > button, you can include in the text predefined variables (whose value is assigned automatically by MZ-Tools, such as selected text, name of method, etc.) or user-defined variables (whose value is asked when the code template is inserted).
  • Author: the author of the code template.
  • Comment: a comment or explanation about the code template.

For Visual Studio:

  • Expansion Keyword (optional): a keyword that you can type in the code window and then "expands" it to the whole template text. This can save you time since you avoid the use of the Code Library toolwindow. To learn how to expand a keyword see Keyword Expansion.
  • Command Name (optional): MZ-Tools provides nine commands (MZTools.CodeTemplate1 ... MZTools.CodeTemplate9 for Visual Studio 2015 and higher, and MZTools8.CodeTemplate1 ... MZTools8.CodeTemplate9 for Visual Studio 2013 and lower) that you can associate with code templates. When you execute a code template command (typically through a keyboard shortcut, or creating a button on a toolbar from that command), the associated code template text is inserted in the code.

For VB6 / VBA:

  • Expansion Keyword (optional): a keyword that you can type in the code window and then "expands" it to the whole template text. This can save you time since you avoid the use of the Code Library toolwindow. To learn how to expand a keyword see Keyword Expansion.
  • Keyboard Shortcut (optional): you can define a keyboard shortcut that, when invoked, the associated code template text is inserted in the code.

See Also:

Code Library

Predefined Variables

User-defined Variables

Keyboard Shortcuts Options