glimpses of the future

1 min read

Glimpse v1.0

Glimpse can now build call graphs, showing you exactly how functions relate to each other in your codebase.

# what does main call?
glimpse code main.rs:main

# what calls this function? (reverse call graph)
glimpse code requests.py:process_request --callers

# limit the depth
glimpse code :build --depth 3

This works by parsing your code with tree-sitter, extracting function definitions and calls, then resolving those calls to their actual definitions.

Precise mode

Sometimes tree-sitter based resolution isn’t enough. Maybe you’re dealing with dynamic dispatch, generics, or just a language with particularly complex module resolution. For this, Glimpse can use LSPs to resolve definitions semantically.

glimpse code :main --precise

This spins up actual LSP servers and uses goto-definition / goto-implementation to resolve calls. It’s slower, but accurate. Glimpse will attempt to auto-install the LSP servers for you.

Indexing

Glimpse eagerly caches whatever it finds into an incremental index. But you can choose to pre-build the index ahead of time for instant queries.

# build the index
glimpse index build

# with LSP for precise resolution
glimpse index build --precise

# check what you've got
glimpse index status

The index stores all the definitions, calls, and resolutions so subsequent queries are fast.

Language support

Glimpse now supports: Go, Rust, C, C++, Python, TypeScript, JavaScript, Zig, Java, Scala, Nix, Lua, Ruby, C#, Kotlin, Swift, and Haskell.

Each language has custom tree-sitter queries for extracting definitions, calls, and imports. The grammars are downloaded and compiled automatically on first use.

Try it

# install
cargo install glimpse

# or with homebrew
brew tap seatedro/glimpse && brew install glimpse

# or with nix
nix profile install github:seatedro/glimpse

# then just
glimpse code :main