Python CodeLens is a Visual Studio Code extension that displays reference counts for Python symbols such as Classes, Methods, and Functions. This extension helps developers quickly identify how many times and where a particular symbol is referenced within the workspace.
Features
Reference Counts: Displays the number of references for classes, methods, and functions directly above the symbol.
Navigation: Click on the reference count to view and navigate to the referenced locations.
Auto-Refresh: Automatically refreshes the reference counts when Python files are modified, created, or deleted.
Configuration Watcher: Watches for changes in the Python interpreter configuration and refreshes the reference counts accordingly.
[!WARNING]
Please note that enabling the filterImports configuration may impact performance, as it iterates through all references and applies a regex to filter out import references. For large projects, we recommend keeping this option disabled.
enableCodeLens: Controls the enablement of the entire CodeLens feature.
filterImports: Provides a configuration option to exclude import statements from the Reference Count and Peek Preview window.
filterDefinitions: Offers a configuration setting to exclude symbol definitions from the Reference Count and Peek Preview window.
Requirements
Python Extension: This extension depends on the Python Extension by Microsoft. Ensure that you have this extension installed and configured before using Python CodeLens.
Install the Python CodeLens extension from the Visual Studio Code Marketplace.
Reload or restart Visual Studio Code to activate the extension.
Usage
Open a Python file in Visual Studio Code.
The reference counts for classes, methods, and functions will be displayed above the respective symbols.
Click on the reference count to view and navigate to the referenced locations.
Known Issues
Ensure that the Python environment or interpreter is selected to avoid errors.
Implement an effective logging mechanism for better error handling and debugging.
Release Notes
1.0.0
Initial release of Python CodeLens.
1.0.1
Bug fixes and performance enhancements implemented by introducing a caching mechanism.
1.0.2
Introduced configurations to manage reference count and Peek Preview visibility for symbol definitions and import statements. Refer to the feature section for more details on the new configuration options.
Contributing
Contributions are welcome! We are working on setting up the public repository where people can open an issue or submit pull requests.
License
This project is licensed under the MIT License and details will be updated soon.