Skip to content

Restore inheritance gutter markers on Twig blocks - #308

Merged
Soner (shyim) merged 1 commit into
mainfrom
twig-block-gutter-markers
Aug 21, 2026
Merged

Restore inheritance gutter markers on Twig blocks#308
Soner (shyim) merged 1 commit into
mainfrom
twig-block-gutter-markers

Conversation

@shyim

Copy link
Copy Markdown
Member

Summary

Fixes #307

The Symfony plugin used to show inheritance gutter markers on Twig blocks. After 0.1.0 replaced that integration with native sw_extends navigation, the markers disappeared.

This restores them as a plugin-owned RelatedItemLineMarkerProvider on {% block name %}:

  • Overrides (up the chain): shown when the template extends another one and the same block exists upstream. Clicking navigates to those blocks, nearest parent first.
  • Overridden (down the chain): shown when other templates extending this one define the same block. Clicking navigates to those overrides.

Sibling templates that all write @Storefront/... are not treated as children of each other. Downstream resolution uses a reverse sw_extends index (ShopwareTemplateExtendsIndex) plus the existing block index, so deciding whether to show a marker does not load other templates' PSI.

TwigUtil.getExtendsChainPaths is now cached per file, since every block of a template walks the same chain.

Tests

TwigBlockMarkerTest covers:

  • core template only marked as overridden
  • plugin in the middle of the chain marked in both directions
  • last override (theme) only marked as overriding, not as a child of its siblings
  • a block with no related blocks has no marker
  • overrides marker navigates up the whole chain, nearest parent first
  • overridden marker navigates to every override

A block now shows an "overrides" icon when it overrides a block of the
sw_extends chain and an "overridden" icon when extending templates
override it. The markers are provided by the plugin itself and no
longer require the Symfony plugin.

Fixes #307
@shyim
Soner (shyim) merged commit 386482d into main Aug 21, 2026
4 checks passed
@shyim
Soner (shyim) deleted the twig-block-gutter-markers branch August 21, 2026 05:09
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.

Inheritance marks missing

1 participant