Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

refs

Find symbol references and list symbols defined in a file.

Synopsis

bobbin refs find [OPTIONS] <SYMBOL>
bobbin refs symbols [OPTIONS] <FILE>

Description

The refs command has two subcommands:

  • find — Locate where a symbol is defined and list all usages across the indexed codebase.
  • symbols — List every symbol (functions, structs, traits, etc.) defined in a specific file.

Both subcommands query the vector store index built by bobbin index.

Global Options

These options apply to both subcommands:

OptionShortDefaultDescription
--path <DIR>.Directory to search in
--repo <NAME>-rFilter results to a specific repository

Subcommands

refs find

Find the definition and usages of a symbol by name.

bobbin refs find [OPTIONS] <SYMBOL>
Argument/OptionShortDefaultDescription
<SYMBOL>Symbol name to find references for (required)
--type <TYPE>-tFilter by symbol type (function, struct, trait, etc.)
--limit <N>-n20Maximum number of usage results

Example:

# Find all references to "Config"
bobbin refs find Config

# Find only struct definitions named "Config"
bobbin refs find --type struct Config

# Limit results to 5
bobbin refs find -n 5 parse_file

refs symbols

List all symbols defined in a file.

bobbin refs symbols <FILE>
ArgumentDescription
<FILE>File path to list symbols for (required)

Example:

bobbin refs symbols src/main.rs

# With verbose output to see signatures
bobbin refs symbols --verbose src/config.rs

JSON Output

refs find --json

{
  "symbol": "Config",
  "type": "struct",
  "definition": {
    "name": "Config",
    "chunk_type": "struct",
    "file_path": "src/config.rs",
    "start_line": 10,
    "end_line": 25,
    "signature": "pub struct Config { ... }"
  },
  "usage_count": 3,
  "usages": [
    {
      "file_path": "src/main.rs",
      "line": 5,
      "context": "use crate::config::Config;"
    }
  ]
}

refs symbols --json

{
  "file": "src/config.rs",
  "count": 4,
  "symbols": [
    {
      "name": "Config",
      "chunk_type": "struct",
      "start_line": 10,
      "end_line": 25,
      "signature": "pub struct Config { ... }"
    }
  ]
}

Prerequisites

Requires a bobbin index. Run bobbin init and bobbin index first.

See Also

  • deps — show import dependencies for a file
  • search — semantic search across the codebase