Inline CodeLens indicators for overridden and implemented methods in Python.
Features
Cross-File Support: Works across your workspace.
Implementation Detection: Identifies methods that are implemented/overridden by parent/subclasses.
CodeLens Navigation:
Overrides: Click the "Overrides Parent.method" CodeLens to navigate to the parent definition.
Implementations: Click "Implemented in Child.method" to navigate to the subclass implementation.
Multiple Implementations: If multiple subclasses implement a method, a dropdown allows you to choose which one to navigate to.
Deep Inheritance Support: Detects overrides across multiple levels of inheritance
Bread -> Sandwich -> Burger
Examples
Inheritance CodeLens
Navigation
Requirements
The Python extension for VS Code (ms-python.python) must be installed and active.
Extension Settings
Setting
Description
pythonOverrideMark.maxInheritanceDepth
Maximum depth to search for parent classes (recursive inheritance). Default is 3. Set to 0 for unlimited
How it Works
This extension uses the VS Code Python extension's Language Server Protocol (LSP) features to analyze your code:
Override Detection: It scans the active document for class definitions and resolves their parent classes (even across files). It then compares methods to identify overrides.
Implementation Detection: It finds references to the current class to identify subclasses. It then checks those subclasses for methods that implement or override methods in the parent.
Performance: Detection is debounced (default 500ms) and optimized to skip non-class symbols to ensure a smooth editing experience.
Future Improvements
Toggle Settings: Add a setting to toggle "Parent -> Child" and "Child -> Parent" lens independently.
Localization: Support multiple languages for CodeLens text.
Contributing
Contributions are welcome!
Feel free to open an issue for bugs or feature requests, or submit a pull request.