If you're a Neovim user, you've probably heard of (or use) Telescope.nvim
One of the most powerful tools in the Neovim ecosystem for fuzzy navigationβfiles, text, symbols, git commits, branches, and more, all in a single interface.
What if you could have that same experience in VS Code?
That's the motivation behind Code Telescopeβan extension that brings Telescope's philosophy to Visual Studio Code.
π― The Problem It Solves
Let's be honest: VS Code already has several ways to search for things:
-
Ctrl+Pfor files -
Ctrl+Shift+Ffor text -
Ctrl+Shift+Ofor symbols -
Ctrl+Shift+Gfor git
But each of these is a different interface, with different behaviors, and different keyboard shortcuts. There's no unified "hub" for searching.
Code Telescope solves this by providing a single interface that abstracts all these functionalitiesβand moreβinto a consistent, extensible, and powerful fuzzy finder.
ποΈ Architecture: Extensibility via Decorators
The extension is built on three architectural pillars:
- Annotation-based adapters β Each finder is registered via decorators
- Backend/UI separation β Extension host (backend) separate from webview (UI)
- Type-safe communication β Shared interfaces between layers
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Extension Host (Backend) β
β βββββββββββββββββββ β
β β Finder Providersβ β
β β @FuzzyFinder() β β
β ββββββββββ¬βββββββββ β
β β β
β β β
β β β
β ββββββββΌβββββββββ β
β β Presentation β β
β β Layer β β
β β - Registry β β
β β - Handlers β β
β ββββββββ¬βββββββββ β
βββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββ
β Message Protocol (type-safe)
βββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββ
β ββββββββΌβββββββββ Webview (UI) β
β β Webview β β
β β Controller β β
β ββββββββ¬βββββββββ β
β β β
β βΌβββββββββββββββββ β
β β β β
β βββββββΌββββββ βββββββββΌβββββββββ β
β β Data β β Preview β β
β β Adapters β β Renderers β β
β βββββββββββββ β @PreviewRender β β
β β () β β
β ββββββββββ¬ββββββββ β
β β β
β ββββββββββΌβββββββββ β
β β Keyboard β β
β β Handlers β β
β βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Finders (Backend)
Finders are data providers registered via @FuzzyFinderAdapter:
@FuzzyFinderAdapter({
fuzzy: "workspace.files",
})
export class WorkspaceFileProvider implements IFuzzyFinderProvider {
async querySelectableOptions(): Promise<QueryResult> {
// Return list of files
}
async onSelect(identifier: string): Promise<SelectResult> {
// Action on selection (open file, navigate, etc.)
}
}
π Data Adapters (UI)
On the UI side, data adapters transform backend data into displayable options:
export class FileDataAdapter implements IFuzzyFinderDataAdapter {
parseOptions(data: any): FileOption[] {
// Convert backend data to UI options
}
getDisplayText(option: FileOption): string {
// Define how the option appears in the list
}
filterOption(option: FileOption, query: string): boolean {
// Custom filtering logic
}
}
Data adapters are the bridge between raw backend responses and the interactive list shown to users.
π¨ Preview Renderers (UI)
Preview renderers are also on the UI side and transform raw data into visual representations, registered via @PreviewRendererAdapter:
@PreviewRendererAdapter({
adapter: "preview.codeHighlighted",
})
export class CodeHighlightedPreviewRenderer implements IPreviewRendererAdapter {
async render(
previewElement: HTMLElement,
data: PreviewData,
theme: string
): Promise<void> {
// Render syntax-highlighted code in the preview pane
}
}
This keeps the backend cleanβit only provides dataβwhile the UI is responsible for how that data looks.
Code Telescope supports any VS Code theme out of the box. The preview uses Shiki as the syntax highlighter, optimized for minimal bundle size by loading only the necessary grammars on-demand. This means syntax highlighting that perfectly matches your current themeβwhether you're using Dracula, One Dark Pro, or any custom themeβwithout bloating the extension.
π¦ What's Built-In
The extension ships with a complete suite of finders:
- Workspace files β Fuzzy matching across all files
- Text search β Integrated ripgrep
- Symbols β Functions, classes, variables
- Git branches β Quick branch switching
- Keybindings β Browse VS Code shortcuts
- Recent files β Recently opened files
- Color schemes β Theme switching
- Diagnostics β Errors, warnings, hints
- Tasks β Workspace tasks
- Call hierarchy β Function call relationships
And the best part: all with inline preview and keyboard-only navigation.
π― Harpoon: Bookmarking Style
Inspired by ThePrimeagen's Harpoon, I also included a bookmarking system:
- Mark files with
Ctrl+Alt+M - Navigate with
Ctrl+1throughCtrl+9 - View all marks with
Ctrl+Alt+H - Persists per workspace
This allows instant navigation to your most important filesβno searching required.
π§ Extensibility: Creating Your Own Finders
One of the coolest parts: you can create custom finders without touching the extension code.
Just create a .cjs file in .vscode/code-telescope/:
module.exports = {
fuzzyAdapterType: "custom.example",
backend: {
async querySelectableOptions() {
return { items: ["Item 1", "Item 2"] };
},
async onSelect(item) {
return { data: item, action: "showMessage" };
}
},
ui: {
dataAdapter: {
parseOptions(data) {
return data.items.map((item, i) => ({ id: i, text: item }));
},
getDisplayText(option) {
return option.text;
},
filterOption(option, query) {
return option.text.toLowerCase().includes(query.toLowerCase());
}
}
}
};
The system does the restβautomatic wiring via the type system. You can check an example here
π€ Why This Architecture?
I chose this design for several reasons:
- Decoupling β Finders don't know about UI, UI doesn't know about implementation details
- Testability β Each component can be tested independently
- Type safety β Compile-time guarantees prevent integration bugs
- Extensibility β New finders without touching existing code
The decorator-based approach means the registry is built at compile-time, and the message protocol ensures the backend and UI stay in sync.
π‘ Inspiration
Obviously, Telescope.nvim by tjdevries (TJ DeVries) was the main inspirationβthe fuzzy finder that revolutionized Neovim navigation.
And Harpoon by ThePrimeagenβthe bookmarking system that changed how we think about file navigation.
What makes Telescope special isn't just the functionalityβit's the extensibility and the unified experience. Code Telescope tries to capture that same essence.
If you use VS Code and miss Telescope's power, check it out on the VS Code Marketplace or Open VSX.
Youtube video explaining (It is in portuguese BR, but you can enable automatic translation)
Check code on Github
Feedback and contributions are welcome!
Top comments (0)