Skip to content

Add optional gutter markers for Python overrides and implementations - #2

Merged
maxo99 merged 3 commits into
maxo99:mainfrom
showpiecep:feat/gutter-icons
May 14, 2026
Merged

maxo99 merged 3 commits into
maxo99:mainfrom
showpiecep:feat/gutter-icons

Conversation

@showpiecep

Copy link
Copy Markdown
Contributor

Addresses #1 by adding optional gutter markers for override and implementation cases while keeping the existing CodeLens workflow intact.

What changed

This PR adds optional gutter markers for Python override and implementation cases while keeping the existing CodeLens workflow intact.

Included:

  • a dedicated OverrideGutterManager to render gutter icons for:
    • methods overriding a parent method
    • methods implemented in subclasses
  • light and dark SVG assets for both marker types
  • integration of gutter marker updates into the existing extension lifecycle
  • a dedicated OverrideHoverProvider so override/implementation details are shown once through the editor hover system
  • a new pythonOverrideMark.gutterIcons.enabled setting
  • README updates describing the new optional behavior

Why

The extension already provides useful CodeLens-based navigation, but override and implementation relationships are still easy to miss in OOP-heavy Python code.

Optional gutter markers improve visual discoverability and make the extension feel closer to the IDE experience users often expect, without replacing CodeLens or changing the core analysis pipeline.

What did not change

  • CodeLens remains the primary navigation mechanism
  • the existing override/implementation detector remains the single source of truth
  • no separate analysis pipeline was introduced for gutter rendering
  • gutter markers do not pretend to be clickable

Limitations

  • VS Code does not provide a reliable PyCharm-like clickable gutter interaction for this scenario
  • the marker is a visual indicator only
  • hover text is provided through the editor hover system on the method line rather than being guaranteed directly on the gutter icon itself

Validation

Validated with:

  • npm run compile
  • manual testing in Extension Development Host

Manual scenarios checked with files in py-sample/:

  • basic override detection
  • multiple subclass implementations
  • methods without inheritance do not get markers
  • multi-level inheritance
  • cross-file parent/child relationships
  • enabling and disabling pythonOverrideMark.gutterIcons.enabled

Notes

  • the same analysis result is reused for both CodeLens and gutter rendering
  • the change is intentionally local and avoids a larger refactor

Screenshots

Screenshots can be added before merge if needed:

  • override marker
  • implementation marker
  • gutter markers disabled

…tions

Introduce a dedicated gutter decoration layer that reuses the existing
override/implementation analysis without changing the detector logic.

Changes included:
- add OverrideGutterManager to render gutter icons for:
  - methods overriding a parent method
  - methods implemented in subclasses
- wire gutter updates into the extension lifecycle alongside the existing CodeLens flow
- keep CodeLens as the primary navigation mechanism
- add a HoverProvider so users get a single, non-duplicated explanation on the method line
- add light/dark SVG assets for override and implementation markers
- add the pythonOverrideMark.gutterIcons.enabled setting
- update README with the new optional gutter marker behavior

Notes:
- gutter markers are visual indicators only and do not pretend to be clickable
- the existing CodeLens-based navigation remains unchanged
- the same analysis result is reused for both CodeLens and gutter rendering
Introduce a dedicated HoverProvider for Python override and implementation
markers so hover text is shown once on the method line instead of being
duplicated by both decoration hover messages and editor hover rendering.

Changes included:
- add OverrideHoverProvider to build hover text from existing OverrideItem results
- register the hover provider in the extension lifecycle
- keep hover state in sync with the active editor and analysis updates
- clear hover state when the editor changes or when results are reset
- remove hoverMessage from gutter decorations to avoid duplicate tooltip content
- respect pythonOverrideMark.gutterIcons.enabled when providing hover content

Notes:
- gutter icons remain visual markers only
- hover is now provided through the editor hover system on the method line
- existing CodeLens navigation behavior remains unchanged
@maxo99

maxo99 commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Hi @showpiecep,

Thank you for submitting a contribution.

Having come from PyCharm, my first target was adding the markers in the gutters as you have implemented.

Visually this looks good, but functionally I think the same limitations I had are still present.

  1. The icons in the gutter are restricting from adding breakpoints. It does seem that right clicking can get breakpoints added/removed.

  2. The icons in the gutter do not allow you to navigate by clicking the icons. If this can be added to the context menu I think that would help retain navigation functionality that is currently lost by this PR.

Do you have any thoughts or improvements in relation to the gutter icon functionalities.

Thanks,
@maxo99

@showpiecep

Copy link
Copy Markdown
Contributor Author

Hi @maxo99,

Thanks for the thoughtful review.

I agree that preserving native gutter behavior is important, especially around breakpoints. In my testing, breakpoints could still be added above or below the marker, and also via right click as you mentioned, so it seemed to me that breakpoint functionality is still partially preserved, even though the gutter becomes more constrained than the default behavior.

The goal of this PR was not to replace CodeLens or move navigation into the gutter, but to add an optional visual cue that makes override/implementation relationships easier to spot when scanning codebases with a lot of inheritance and method overriding. The existing CodeLens-based navigation is still preserved; what this PR does not add is direct click navigation from the gutter marker itself.

From what I could find, I was not able to identify a clean VS Code API-supported way to make the gutter marker behave more like a PyCharm marker without interfering with native gutter behavior.

Given that, I would frame this feature as an optional visual enhancement rather than a gutter-based navigation feature.

Thanks again for taking the time to review this.

Update the gutter icon configuration so the feature is hidden by default
and must be explicitly enabled by the user.

Changes included:
- change pythonOverrideMark.gutterIcons.enabled default to false
- align runtime fallback values with the contributed configuration default
- update README to document the new default behavior

Notes:
- CodeLens remains available by default
- gutter markers can still be enabled explicitly through settings
- this change avoids changing breakpoint-related gutter behavior unless the
  user opts in
@showpiecep

Copy link
Copy Markdown
Contributor Author

Hi @maxo99, I pushed the requested update: gutter icons are now disabled by default and must be explicitly enabled by the user. I also aligned the runtime fallback values and README with that behavior. I manually verified the default-off and enable/disable flow in the extension host.

@maxo99
maxo99 merged commit 62646f4 into maxo99:main May 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants