Skip to main content
The tags command runs symbol tagging on an arbitrary file and outputs a list of tags. This is useful for code navigation features.
For more information, see Code Navigation - Tagging and Captures.

Input Sources

File Paths

Pass file paths directly:

Paths File

Use --paths to provide a file containing paths:

Standard Input

If no paths are provided, input is read from stdin:

Output Format

The command outputs tags in a format suitable for code navigation tools. Each tag includes:
  • Symbol name
  • Symbol kind (e.g., function, class, variable)
  • Location (file, line, column)
  • Scope information

Options

Input Options

file
The path to a file that contains paths to source files to tag.
path
The path to the directory containing the grammar. Implies --rebuild.
scope
The language scope to use for symbol tagging. Useful when the language is ambiguous.
number
Generate tags from the contents of a specific test.

Output Options

flag
Suppress main output.
flag
Print the time taken to generate tags for the file.

Build Options

flag
Force a rebuild of the parser before running tags.
path
The path to an alternative configuration (config.json) file. See init-config.

Examples

Generate Tags for a File

Generate Tags for Multiple Files

Generate Tags with Performance Measurement

Generate Tags from File List

Generate Tags with Specific Scope

Tag Queries

Tags are generated using the queries/tags.scm query file in your grammar repository. This file defines patterns for extracting symbols. Example tag query:
For more information on writing tag queries, see the Code Navigation documentation.