Skip the Copy-Paste: Reference Any Code Instantly
Tired of manually typing file paths and copying code snippets when asking Forge for help? This VS Code extension lets you reference any code with a single keystroke.
What This Extension Does
The problem: Describing code problems is slow and unclear
- "That function around line 50 something..."
- Copy-pasting code snippets manually
- Typing out long file paths
The solution: Show Forge exactly what you mean
- Select any code → Press
Ctrl+U
→ Get a perfect reference - Works with single lines, code blocks, or entire files
This extension works with Forge CLI. Install that first if you haven't already.
See It in Action
What you just saw: Select code → Press Ctrl+U
→ Reference copied and ready to use with Forge.
Installation
What You Need
- VS Code: Version 1.102.0 or higher
- Forge CLI: Install it first if you haven't already
Install the Extension
Option 1: VS Code Marketplace (Easiest)
- Open VS Code
- Press
Ctrl+Shift+X
(Extensions panel) - Search for "Forge Code"
- Click Install on the official ForgeCode extension
Option 2: Command Line
code --install-extension ForgeCode.forge-vscode
Test that it works: Open any code file, select some text, press Ctrl+U
. If something gets copied to your clipboard, you're ready to go!
Official extension: VS Code Marketplace
Basic Usage
The Core Workflow
- Select code (or don't select anything for whole file)
- Press
Ctrl+U
- Paste into Forge conversation
That's it. No typing, no manual copying.
What Gets Copied
Format: @[<filepath>:<line start>:<line end>]
How selection works:
- No selection:
@[path/to/file.js]
→ References entire file - Single line:
@[path/to/file.js:42:42]
→ References line 42 only - Multiple lines:
@[path/to/file.js:15:28]
→ References lines 15-28
Power Move: Multi-File References
Here's the real power move. Select code from different files and copy them all at once:
> Compare these approaches @[src/utils/oldMethod.js:15:45] @[src/utils/newMethod.js:20:50]
> Review this component and its styles @[components/Button.tsx] @[styles/button.css:12:34]
Now Forge can see exactly what code you're talking about, with full context and precise line numbers. No more "that function around line 50 something" conversations.
Alternative Ways to Copy
- Command Palette:
Ctrl+Shift+P
→ type "Copy File Reference" - Right-click Menu: Select code → right-click → "Copy File Reference"
Real-World Examples
Debugging Issues
Scenario: Authentication fails in production but works locally.
> Help me debug this auth function @[src/auth/AuthService.ts:45:67] - works locally but fails in production
Forge sees the exact code and can suggest environment-specific issues to check.
Code Reviews
Scenario: You spot a component that could be improved.
> Can you refactor this component to use hooks? @[components/UserProfile.tsx:12:89] Also suggest performance optimizations
Instead of generic advice, Forge sees your specific component and suggests targeted improvements.
Type Mismatches
Scenario: API data doesn't match your TypeScript types.
> @[src/api/users.js:156:203] @[src/types/User.ts] have a type mismatch - API returns 'user_id' but type expects 'userId'
Forge compares both files simultaneously and suggests proper fixes.
Feature Implementation
Scenario: Adding dark mode across multiple components.
> Add dark mode support to @[src/components/ThemeProvider.tsx:15:45] and update @[src/styles/theme.css:23:67]
Forge understands your theme system and suggests consistent changes across files.
When Things Don't Work
Extension Completely Dead
Quick fixes to try:
- Make sure Forge CLI is actually installed - run
forge --version
in terminal - Check your VS Code version (Help → About) - need 1.102.0+
- Verify the extension is enabled in Extensions view
- Restart VS Code completely
Ctrl+U Does Nothing
This usually means another extension grabbed that shortcut. Here's how to fix it:
- File → Preferences → Keyboard Shortcuts
- Search for "Forge"
- Click the pencil next to "Copy File Reference"
- Pick a new combo like
Ctrl+Shift+U
orAlt+U
Common culprits: Vim extensions, other developer tools that love Ctrl+U.
Nothing Gets Copied to Clipboard
Try these workarounds:
- Use Command Palette:
Ctrl+Shift+P
→ "Copy File Reference" - Right-click menu → "Copy File Reference"
- Check if you're in a text file (extension won't work on images/binaries)
- Some systems have clipboard permission issues - restart VS Code usually fixes this
Weird File Paths
Sometimes you'll see paths like /workspaces/project/src/file.js
instead of normal ones.
This is actually fine. VS Code uses different path formats for remote development, containers, and workspace setups. Forge handles these correctly, so don't worry about how they look.
Pro Tips
Start small: Reference one function, ask Forge about it, see how it responds. Then level up to multi-file references.
Be selective: Don't dump entire files unless you actually need context from the whole thing. Forge works better with focused references.
Combine with descriptions: @[component.tsx:45:67] this validation logic isn't working with empty strings
gives Forge both code and context.
Next Steps
You're ready to start using Ctrl+U
everywhere. The goal isn't to reference every line of code - it's to give Forge just enough context to actually help with your specific situation.
Related Guides
- File Tagging with @: Enhance AI Context for Faster Developer Workflow
- Quickstart: Get started with Forge in minutes
- Built-in Commands: Essential commands for productive workflows
Still Need Help?
If you're still stuck:
- Extension logs: View → Output → Select "Forge" from dropdown
- Report bugs: GitHub Issues
- Community help: Join our Discord for quick answers