Stop saying "Check line 50" and start linking directly to the code.
Code Direction allows you to generate deep links to specific lines of code within your local VS Code workspace. When you share this link with a coworker, it opens their VS Code, navigates to the exact file, and highlights the specific lines you selected.
Note: This is perfect for teams working on the same repository. It uses relative file paths (e.g., src/components/Button.js) to ensure links work across different machines.
Features
1. Quick Link Generation
Simply highlight the code you want to discuss, right-click, and generate a link instantly.
Right-Click: Select text > Right-click > Code Direction: Copy Link
Command Palette: Press Ctrl+Shift+P > Type "Code Direction: Copy Link"
2. Seamless Navigation
When your coworker clicks the vscode:// link you sent them:
VS Code comes to the foreground.
The correct file opens automatically.
The specific lines are highlighted and centered on the screen.
Usage Guide
For the Sender
Open any file in your workspace.
Highlight the lines of code you want to share.
Right-click the selection and choose Code Direction: Copy Link.
Paste the URL into Slack, Teams, or Email.
For the Receiver
Ensure you have Code Direction installed.
Ensure you have the same project/repository open in VS Code.
Paste the URL into your browser (or click it if your chat app supports protocol links).
VS Code will handle the rest!
Requirements
Both users must have this extension installed.
Both users must have the same file structure (e.g., working on the same Git repository).
Both users must have the same workspace open.
The extension relies on Relative Paths. If you rename a file locally and send a link, the recipient won't be able to open it until they also have that file name.
Extension Settings
This extension currently requires no configuration. It works out of the box!
Known Issues
If the recipient does not have the workspace open, VS Code may prompt them to open a folder before it can locate the file.
Links are generated based on file structure, not Git commits. If the file content on the recipient's machine is drastically different, the highlighting might be off by a few lines.
Release Notes
0.0.1
Initial release of Code Direction.
Added support for generating vscode:// protocol links.
Added Right-click context menu integration.
Added logic to parse relative paths and highlight line ranges.