Building and Managing Tag Files

Context Tagging® creates tag files to store information about symbols and, optionally, cross-reference information from your source code. Many of the most powerful features of SlickEdit® Core use this information to speed your coding.

Tag File Categories

SlickEdit Core creates 4 kinds of tag files. The "Context Tagging - Tag Files" dialog (Tools → Tag Files) lists the tag files by category.

  • Project tag files contain the symbols in the files that are part of your projects. Your project tag files are listed under "Workspace Tag Files". This will change when you switch workspaces in SlickEdit Core.

  • Compiler-specific tag files are used only when the specified compiler is selected in Project Properties. The compiler tag files are listed with the name of the compiler in quotes followed by "Compiler Configuration Tag Files".

  • Language-specific tag files are used anytime you code in a particular language. This is useful for things like third-party libraries that you use a lot. These tag files are listed by language. For example, the C/C++ library tag files are listed under '"C/C++" Tag Files'.

  • Auto-Updated tag files are designed to be shared by multiple users of SlickEdit® Core on a network. You can use the vsmktags utility to rebuild these tag files as part of your nightly build process. When SlickEdit Core detects that a newer version of an auto-updated tag file is available, it will automatically copy in the newer version and begin using it. These files are listed under "Auto-Updated Tag Files".

Building Tag Files

Each kind of tag file is built differently. Refer to the following sections for how to build each kind.

Caution

We do not recommend you run a second copy of the editor to perform tag file updating because it will cause tag file access problems. Under UNIX the editor will crash if multiple editors are updating the same tag files.

Creating Tag Files for Workspace Files

Tag files for your workspace files are automatically created and updated as you edit. If you edit a source file with a different editor, you will have to retag the file or workspace to make sure that the symbol information is up to date.

To retag your workspace, do either of the following:

  • Use the Projects view - right-click on the root node and select Retag Workspace.

  • Use the Context Tagging - Tag Files dialog - select Tools → Tag Files from the main menu. Select the tag file listed under Workspace Tag File and click the Rebuild Tag File button.

Creating Tag Files for Compiler-Specific Libraries

The Tag Compiler Libraries dialog is used to tag libraries associated with the most commonly used languages in SlickEdit Core. This dialog appears as part of the Quick Start Configuration Wizard, when SlickEdit® Core is run for the first time. It allows you to build tag files for commonly used languages and their libraries, including C, C++, Java, and .NET. You can access this dialog at any time from the Context Tagging - Tag Files Dialog (select Tools → Tag Files, then click Auto Tag).

To create tag files for the languages listed, select the packages you want to build. If you want to have the tag files built in the backgroun, select Build tag files using a background thread. Click OK to begin. If you have chosen to build your tag files in the foreground, then the Building Tag Files dialog box opens, showing the progress as the tag file is built.

If you have chosen to build in the background, the progress dialog shows the progress of queuing files for background tagging. You can then continue to edit code while your files are being tagged. To inform you of the progress of this task, an icon id displayed in the Alert area. While background tagging is being performed, the icon is highlighted.

You can configure some compilers by selecting them in the tree and then clicking the Configure button. This will open the Compiler Properties dialog for that language.

For languages not listed on the "Create Tag Files for Compiler Libraries" dialog, you can create language-specific tag files (see Configuring Other Languages).

In the Compiler Properties dialog, do the following:

  1. Click Add to enter the name of the compiler you are configuring.

  2. Click Set Default if this is the main compiler you use for this language.

  3. Click the ... button (ellipses) next to the "Built-in Compiler Include Directories" field to specify an include directory. SlickEdit Core will tag all files in that directory and any subdirectories.

  4. Click Build Tag File to build the tag file for this compiler.

  5. Click OK to finish.

Creating Language-Specific Tag Files

Language-specific tag files provide the same symbolic information for libraries that is provided for code in your projects. A library is a pre-built unit of code that is not edited as part of this development effort. These tag files are accessible from any project written in the same language.

Note

Language-specific tag files are used by all projects using that language. If you have a library that is used by one project and not another, the symbols in that library will show up as completions in both projects.

You should create a language-specific tag file for any library that is not a compiler-specific library or part of the codebase you are editting. For example, you may have local libraries that are reused from project to project.

To create a language-specific tag file, complete the following steps:

  1. From the main menu, select Tools → Tag Files. The Context Tagging - Tag Files Dialog is displayed.

  2. Click Add Tag File to open the Add Tag File dialog.

  3. Select the source type into which you want the tag file inserted. Select Generate References only if you want library functions to be shown when you list references.

    Note

    Generate References creates an inverted file index so that you can quickly find which files contain which symbols. Workspace tag files create this index by default. This information is used to build a list of references (using the push_ref command, bound to Ctrl +/ in the CUA emulation). In general, it's better to have the reference list contain functions that are part of this workspace and not in libraries. If Generate References is not checked, you will still be able to jump from a symbol to its definition in a library using Ctrl+Dot (push_tag).

    This option is off by default since most programmers do not want to see library functions shown in the reference list.

  4. Click OK. The Add Tags Database dialog opens.

  5. Select an existing tag file or enter the name for the new tag file. Most commonly, you will be creating a new tag file. So give it a name that is representative of the library being tagged. If you are tagging the Boost library, you would name the file "Boost". Tag files are required to have the extension .vtg.

  6. Click Open to display the Add Tree dialog. Navigate to the root of the library source code and click the OK button.

  7. The Building Tag File dialog opens showing the progress as the tag file is built. When finished, the contents are displayed in the Context Tagging® - Tag Files dialog.

See Managing Tag Files for more information.

Configuring Context Tagging for COBOL

All of the Context Tagging features for COBOL, except Parameter Information, are provided by scanning COBOL source file and the copy books that are included. This information is used by List Members, completions, tag-driven navigation, symbol preview, and in the Outline view. Parameter Information for COBOL commands and intrinsic functions are provided by the COBOL built-ins file created during product installation. To provide Parameter Information for subroutines, you must build a tag file that will hold linkage information from the subroutine's point of view.

Configuring Context Tagging for Other Languages

For languages other than C/C++, Java, or .Net, you can create language-specific tag files for the standard libraries that are part of those languages.

A tag file is automatically built for the run-time libraries of C#, InstallShield, JavaScript, Perl, PV-WAVE, Slick-C®, Tornado, TCL, and Visual Basic .NET, and usually it is not necessary to build tag files for the run-times of these languages. If you already built a tag file for run-times during installation, you can skip this section. If you are using Perl, Python, or TCL, and the compiler cannot be found in PATH (or registry for Windows), you need to build tag files for these run-time libraries.

Managing Tag Files

The Context Tagging - Tag Files Dialog (Tools → Tag Files) is used to manage your tag files.

The left pane of the dialog lists all of your tag files, separated into categories (see Tag File Categories below). A tag file having a File bitmap with blue arrows indicates the tag file is built with support for cross-referencing. The right pane of the dialog lists all the source files indexed by the currently selected tag file.

For information about the buttons available, see Context Tagging - Tag Files Dialog.

Tag File Search Order

When doing tag lookups, the tag files are searched in a specific order, which affects the tags found. The following are examples of the order in which tag files are searched.

Example: C/C++ Tag File Search Order

If a C/C++ source file is open, when a tagging-related operation is performed, the tag files are searched in the following order:

  1. Project tag files, providing it contains other C/C++ source files.

  2. Auto-updated tag files containing other C/C++ source files.

  3. The "C" Compiler Configuration tag file corresponding to your default C compiler configuration as specified in your project (see C/C++ Compiler Settings), or global default.

  4. Language-specific C tag files, in the order that they are listed in the Context Tagging - Tag Files Dialog. Note that if you have a "C" Compiler Configuration tag file, cpp.vtg will be excluded from this list.

Example: Java Tag File Search Order

If a Java source file is open, when a tagging-related operation is performed, the tag files are searched in the following order:

  1. Project tag files, providing it contains other Java source files.

  2. Auto-updated tag files, containing other Java source files.

  3. Language-specific Java tag files, in the order that they are listed in the Context Tagging - Tag Files Dialog.

Rebuilding Tag Files

The Rebuild Tag File dialog box contains options for rebuilding the selected file. To display the Rebuild Tag File dialog, click select Tools → Tag Files. When the Context Tagging - Tag Files Dialog is displayed, select a file to rebuild, then click Rebuild Tag File.

The following settings are available:

  • Retag modified files only - If checked, SlickEdit® Core will incrementally rebuild the tag file, only retagging files that have been modified since the last time they were tagged. If not checked, SlickEdit Core will rebuild the entire tag file from scratch.

  • Generate References - If checked, the tag file will be built with support for cross-referencing. Tag files with support for references are slightly larger and take slightly more time to build. They will also be included in all symbol references searches, which may not be necessary, especially for third-party libraries.

  • Remove all deleted files without prompting - If checked and the tag file contains a source file which no longer exists on disk, the source file will be removed from the tag file without prompting for confirmation. This checkbox is not present when rebuilding the workspace tag file since the list of files in the workspace's projects determine what files should be tagged.

  • Keep all deleted files without prompting - If checked and the tag file contains a source file which no longer exists on disk, the source file will not be removed from the tag file without prompting for confirmation. This checkbox is not present when rebuilding the workspace tag file since the list of files in the workspace's projects determine what files should be tagged.

  • Retag files in background when possible - If checked the tag file is rebuilt in the background if background tagging is supported for these files.

Note

The options Remove all deleted files without prompting and Keep all deleted files without prompting are mutually exclusive. Selecting one will clear the other.

Workspace Tagging Excludes

SlickEdit Core will automatically tag all source files in your workspace. The Workspace Tagging Excludes dialog allows you to specify absolute paths or partial path components in your workspace, which you want to be excluded from automatically being tagged. This feature is located at Window → SlickEdit Preferences → Editing → Workspace Tagging Excludes.

  • Add Full Path... - Browse to a directory on the file system, and add that directory to the list of workspace tagging exclusions.

  • Add Path Component... - Specify a partial path component to add to the list of workspace tagging exclusions. For example, specifying build will result in any source file under a directory named "build" being excluded from workspace tagging.

  • Delete - Remove an item from the list.

  • Up/Down - Move items in the list up or down, affecting the order in which exclusions are matched against source files when tagging is performed. Items at the top of the list are matched first.

Context Tagging® Options

General Context Tagging® Options

Options are available for setting general parameters for the Context Tagging feature set. You can designate how tagging is done, how references function within the application, and tune the application to maximize performance. To display the options, from the main menu, select Window → SlickEdit Preferences → Editing → Context Tagging. See Context Tagging® Options for descriptions of the options.

Tip

To improve tagging performance, you may need to adjust the tag file cache size (Window → SlickEdit Preferences → Application Options → Virtual Memory). See Virtual Memory Options for more information.

Language-Specific Context Tagging® Options

You can activate and deactivate various Context Tagging features on a per-language basis. To access these options, from the main menu, select Window → SlickEdit Preferences → Languages, expand your language category and language, then select Context Tagging®. See Language-Specific Context Tagging® Options for more information.