Home > front end >  Navigate Sylius theme templates in PhpStorm
Navigate Sylius theme templates in PhpStorm

Time:10-29

When I'm building my own Sylius theme And I click on the template name with the CMD button pressed Then I expect to be able to navigate to that template inside my theme: themes/ThemeName/templates/bundles/SyliusShopBundle/Layout/Header/_logo.html.twig But it is not present in popup choices:

Not all places present

How to fix that?

CodePudding user response:

Create a file

themes/ThemeName/ide-twig.json

with next content:

{
  "namespaces": [
    {
      "path": "templates/bundles/SyliusAdminBundle",
      "namespace": "SyliusAdmin"
    },
    {
      "path": "templates/bundles/SyliusShopBundle",
      "namespace": "SyliusShop"
    },
    {
      "path": "templates/bundles/SyliusUiBundle",
      "namespace": "SyliusUi"
    }
  ]
}

After that - expected choices are shown and I can navigate with two clicks:

Correct choices

If something doesn't work - probably your JSON file has typos (for example, the last items shouldn't end with a comma).

Inspired by https://tomasvotruba.com/blog/2019/01/28/2-files-that-your-symfony-application-misses/

  • Related