Goto Next/Previous Reference
Jump directly to the next or previous reference of the symbol under the cursor — no peek panel, no side bar, just instant navigation.
Features
- Alt+N / Alt+P to cycle through references of the current symbol
- References are sorted (by file path → line → column) for deterministic order
- Wraps around at the ends (configurable)
- Caches the reference list while you stay within the same symbol — no repeated queries
- Works across multiple files
- Falls back to definition-based lookup when direct reference query returns 0 results (workaround for clangd's dependent-type limitation)
Keybindings
| Key |
Command |
Description |
Alt+N |
Goto Next Reference |
Jump to the next reference |
Alt+P |
Goto Previous Reference |
Jump to the previous reference |
You can change these in File > Preferences > Keyboard Shortcuts by searching for Goto Next Reference / Goto Previous Reference.
Configuration
| Setting |
Default |
Description |
gotoNextReference.enableDebugLog |
false |
Enable debug output to the Goto Reference channel in the Output panel |
gotoNextReference.wrapAround |
true |
Wrap around to the first reference after the last one, and to the last reference before the first one |
Known Issue: clangd & Dependent Types
When calling a member function through a dependent type (e.g. (*it)->method() inside a template), clangd's reference provider may return 0 results even though "Go to Definition" works. This is a known clangd limitation:
This extension works around the issue by falling back to definition-based lookup: when the reference provider returns 0 results, it queries vscode.executeDefinitionProvider to find the symbol's definition, then queries references at the definition location instead.
Installation
Install from VSIX (local)
npm install -g @vscode/vsce
npx vsce package
Install it in VS Code:
- Open Extensions (
Ctrl+Shift+X)
- Click ... → Install from VSIX...
- Select the
.vsix file
Install from source (dev mode)
npm install
npm run compile
Then press F5 to launch an Extension Development Host window.
Publishing to the Marketplace
- Create a Microsoft account and an Azure DevOps organization.
- Create a Personal Access Token with scope Marketplace (Publish).
- Install
vsce: npm install -g @vscode/vsce.
- Create a publisher:
npx vsce create-publisher <publisher-name>.
- Update
"publisher" in package.json to match your publisher name.
- Run
npx vsce publish.
See the official publishing guide for details.
Changelog
1.1.0
- Definition-fallback lookup: when
vscode.executeReferenceProvider returns 0 results (e.g. clangd on dependent types like (*it)->method() inside templates), the extension now falls back to querying vscode.executeDefinitionProvider first and re-querying references from the definition location (clangd#258, #399, #675, #1628)
- Added
gotoNextReference.wrapAround setting (default true)
- Normalized cursor to word start before querying reference provider
- Cache only invalidated when a referenced document changes (not on every file change)
- Debug logging controlled by
gotoNextReference.enableDebugLog
1.0.0
- Initial release: Alt+N / Alt+P to jump between references without opening the peek panel
- Reference caching while cycling within the same symbol
- Wrap-around navigation (now configurable)
License
MIT