IDE support for twig templating


#1

Since i read about that spryker avoid using “PHP magic” to maximize IDE support i wonder if this is also true for Yves templating.

The following statements taken from random templates

{% extends template('page-layout-wishlist', 'WishlistPage') %}

{% extends '@Application/Layout/layout.twig' %}

have no real support even by the twig extension in IntelliJ. Or do i miss something?

I can remember that in Symfony at least whenever a template was extended by the @-notation, code completion was available. That means for example:

  • you could hold shift and click the extend statement to jump into the parent template
  • you could hit control + space to get a list of inherited blocks to overwrite

How to activate that for spryker projects? If not, what is a good workaround to jump between templates?

Yes, it seems like a luxury problem, but this are the small things to be very effective

Many thanks


#2

Hi Jim!

Unfortunately, the @-notation might look like the Symfony one, but it is a custom implementation and thus we can’t use the same Twig functionality that is delivered by PhpStorm or other plugins.

Currently we do not have support for your suggested functionality.

Best


#3

@lazystar many thanks for your response. Just one question …

Is there maybe a useful trick/shortcut to get fast to the other template anyway? I mean without navigating through many subfolders. For the first example i found out you can hit cmd+shift+o to open resource and paste the triple (“page-layout-wishlist”) and get the (hopefully) only resulting twig template. But for the second one? :thinking:

Thanks


#4

Easiest thing that comes to mind is entering something more restrictive when looking up files with command + shift + o. E.g. for the template @Application/Layout/layout.twig you could enter app/layout and PhpStorm's partial matching magic will give you a much shorter and more readable list of candidates.


#5

Ok, i’ll try that.

Many Thanks!