List all symbols (functions, structs, classes, constants, etc.) in files — a table of contents with line numbers and nesting.
# List symbols in a file
probe symbols src/main.rs
# JSON output (for programmatic use)
probe symbols src/main.rs --format json
# Multiple files
probe symbols src/main.rs src/lib.rs
# Include test functions
probe symbols src/main.rs --allow-tests
# Plain-text fallback for documentation/config files
probe symbols rsync.1 --format json
# Treat a custom extension as plain text
probe symbols notes.req --text-extension req --format jsonprobe symbols <FILES> [OPTIONS]
| Option | Description | Default |
|---|---|---|
-o, --format |
Output format: text or json |
text |
--allow-tests |
Include test functions/methods | false |
--strict |
Disable plain-text fallback for unsupported extensions | false |
--text-extension EXT |
Treat an extension as plain text (repeatable, with or without .) |
- |
Unsupported extensions fall back to line-oriented text symbols by default. Standard documentation and config-style extensions such as .1, .5, .txt, .conf, .tex, .sh, and .json are treated as plain text.
Plain-text entries use kind: "text", an empty name, and the source line as signature:
[{
"file": "rsync.1",
"symbols": [
{
"name": "",
"kind": "text",
"signature": ".TH rsync 1",
"line": 1,
"end_line": 1
}
]
}]Use --strict when a caller only wants AST-backed symbols and wants unsupported extensions to be reported as warnings. Use --text-extension EXT to force additional suffixes into plain-text mode.
Shows symbols with indentation for nesting:
src/main.rs:
1:795 fn main()
15:28 struct Config { ... }
30:55 impl Config
32:44 fn new() -> Config
45:54 fn validate(&self) -> bool
60 const MAX_SIZE: usize
65:72 enum Status
Returns structured data with nested children:
[{
"file": "src/main.rs",
"symbols": [
{
"name": "main",
"kind": "function",
"signature": "fn main()",
"line": 1,
"end_line": 795,
"children": []
},
{
"name": "Config",
"kind": "impl",
"signature": "impl Config { ... }",
"line": 30,
"end_line": 55,
"children": [
{
"name": "new",
"kind": "function",
"signature": "fn new() -> Config",
"line": 32,
"end_line": 44
}
]
}
]
}]The symbols command detects the following symbol types across languages:
| Kind | Languages | Examples |
|---|---|---|
function |
All | fn main(), def greet(), function hello() |
method |
All | Methods inside classes/impl blocks |
struct |
Rust, Go | struct Config { ... } |
class |
Python, TS/JS, Java | class App { ... } |
interface |
TS, Go | interface Config { ... } |
trait |
Rust | trait Handler { ... } |
impl |
Rust | impl Config { ... } |
enum |
Rust, TS, Java | enum Status { ... } |
const |
Rust, Go, TS/JS | const MAX_SIZE: usize |
static |
Rust | static INSTANCE: ... |
type |
Rust, TS, Go | type Alias = ... |
module |
Rust, TS | mod utils, namespace Api |
macro |
Rust | macro_rules! my_macro |
variable |
TS/JS, Python | const config = ..., MAX_COUNT = 100 |
Container symbols (impl blocks, classes, traits, modules) show their children indented:
- Rust: methods inside
implandtraitblocks - TypeScript/JavaScript: methods inside
classdeclarations - Python: methods inside
classdefinitions - Go: methods are shown at top level (Go uses receiver syntax, not nesting)
- Quick file overview: Understand a file's structure before reading it
- Find the right symbol name: Get exact names for
probe extract file.rs#symbol - Navigate large files: Find line numbers for functions of interest
- Code review: See what changed at a structural level
import { symbols } from '@probelabs/probe';
const result = await symbols({
files: ['src/main.rs'],
cwd: './project'
});
console.log(result[0].symbols);See also: Search | Extract | Query | CLI Reference