Copy Reference JetBrains for VS Code

A VS Code extension that brings JetBrains-style "Copy Reference" functionality specifically for Python (pytest). Right-click on any Python symbol (class, method, function) to copy its pytest-style reference (e.g., module::Class::method) to your clipboard.
✨ Features
- Pytest-style references: Produces JetBrains-style test identifiers such as
tests.test_example::TestThing::test_it.
- Python module/package detection: Resolves package/module paths from your workspace layout (special-cases
__init__.py).
- Test-friendly output: Useful for running single tests with
pytest using file node IDs (e.g., pytest tests/test_example.py::TestThing::test_it).
- Context menu integration: Right-click on a Python symbol to copy its reference
- Instant clipboard copy: Copies the reference to your system clipboard immediately.
🚀 Installation
Option 1: VS Code Marketplace (Recommended)
The easiest way to install:
- Open VS Code
- Go to Extensions (Ctrl/Cmd + Shift + X)
- Search for "Copy Reference - Pytest" (published by Clara Yip)
- Click Install
Note: This extension requires a Python language extension (for example, Pylance or the Microsoft Python extension) to provide symbol information. Make sure the Python extension is installed and enabled in VS Code (and in the Extension Development Host when running in dev mode).

Option 2: Manual Installation from GitHub
For early access or offline installation:
- Download the latest VSIX file from our GitHub Releases
- Open VS Code
- Go to Extensions panel (Ctrl/Cmd + Shift + X)
- Click the "..." menu in the Extensions panel
- Select "Install from VSIX..."
- Navigate to the downloaded
.vsix file and select it
- Click Install
Troubleshooting Installation
Extension not appearing?
- Restart VS Code after installation
- Check if the extension is enabled in the Extensions panel
- Ensure you have a Python file open
- Make sure a Python language extension (e.g., Pylance) is installed and active — the extension relies on the language provider for document symbols
Can't find "Copy Reference" in context menu?
- Make sure you're right-clicking on a Python symbol (class, method, function)
- Try clicking directly on the symbol name, not whitespace
📖 Usage
- Right-click on any symbol in your code
- Select "Copy Reference" from the context menu
- Paste the full dot notation path wherever you need it
Django Testing Example
Perfect for Django testing workflows:
# In myapp/tests/test_models.py
class UserModelTest(TestCase):
def test_user_creation(self):
# Right-click on 'test_user_creation' → Copy Reference
pass
Copied result: myapp.tests.test_models.UserModelTest.test_user_creation
Use in terminal:
python manage.py test myapp.tests.test_models.UserModelTest.test_user_creation
📋 Example Outputs
Python
# myproject/myapp/models.py
class User:
def get_full_name(self):
pass
Copy Reference result: myproject.myapp.models::User::get_full_name
🔧 Supported Languages
- Python (pytest) - Full module and test node support (module::Class::method)**
🎯 Use Cases
- Django Testing: Generate precise test paths for
pytest
- Code Documentation: Reference specific methods in documentation
- Code Reviews: Provide exact paths when discussing code
- Debugging: Quickly reference problematic methods
🤝 Contributing
Found a bug or want to contribute?
- Visit our GitHub repository
- Open an issue or submit a pull request
- Help make this extension even better!
🙏 Acknowledgements
This project is a pytest-focused fork inspired by and building upon the original "Copy Reference" extension by Aaron Kazah. Many thanks to Aaron for the idea and initial implementation — see the original project: https://github.com/aaronkazah/copy-reference-jetbrains
📄 License
MIT License - see LICENSE for details.
🐛 Found an issue? Report it here
📧 Questions? Start a discussion