Copy Code Reference is a VS Code extension that makes it easy to copy code references with the file name and line number directly from the editor.
Features
The extension provides commands to copy references in three formats:
- Filename + line
- Relative path + line
- Absolute path + line
Example output:
extension.ts:12src/extension.ts:12/home/user/project/src/extension.ts:12
How to use
- Open a file in the VS Code editor.
- Select a line or a code snippet.
- Right-click inside the editor.
- Open the
Copy Referencesubmenu. - Choose the reference format you want to copy.
The selected reference will be copied to the clipboard automatically.
Available commands
Copy Filename ReferenceCopy Relative Path ReferenceCopy Absolute Path Reference
Local installation
To install it locally on your machine:
npm install
npm run compile
Then open the project in VS Code and run the extension in a development window.
Development
Build
npm run compile
Watch mode
npm run watch
Requirements
- Node.js
- VS Code
- TypeScript
License
This project is licensed under the MIT License.