Haehnchen / idea-php-symfony2-plugin

IntelliJ IDEA / PhpStorm Symfony Plugin
https://plugins.jetbrains.com/plugin/7219
MIT License
913 stars 137 forks source link

Twig: support namespaced bundle paths #456

Open gharlan opened 9 years ago

gharlan commented 9 years ago

http://symfony.com/doc/current/cookbook/templating/namespaced_paths.html

I get "Missing template" for paths like this:

{% include "@App/Foo/bar.html.twig" %} {# Missing template #}
{# equivalent to: #}
{% include "AppBundle:Foo:bar.html.twig" %}

And I would like to configure which style should be used for autocompletion.

Koc commented 9 years ago
    public function viewAction(LandingTemplate $landingTemplate = null, $simple = false)
    {
        $template = '@MetalProject/Wizzard/landing_page.html.twig'; // ctrl+click doesn't work here
        if ($simple) {
            $template = '@MetalProject/Wizzard/landing_simple_page.html.twig';
        }
    }

Can you look at this, @Haehnchen please?

Haehnchen commented 9 years ago

@MetalProject what is the pathname of this alias? is it a compiled xml path, some xml example? possible related #450, #429

Koc commented 9 years ago
    <service id="twig.loader" class="Symfony\Bundle\TwigBundle\Loader\FilesystemLoader">
      <tag name="twig.loader"/>
      <argument type="service" id="templating.locator"/>
      <argument type="service" id="templating.name_parser"/>
      <!-- ... -->
      <call method="addPath">
        <argument>Z:\home\dev\metalloprokat\src\Metal\ProjectBundle/Resources/views</argument>
        <argument>MetalProject</argument>
      </call>
      <!-- ... -->
    </service>
Haehnchen commented 9 years ago

@Koc your issue is phpstorm9 eap related see #450 for updates

apfelbox commented 9 years ago

This happens for me in every place where you can define templates, even "regular" ones. Only the x:y:z syntax works, so no direct templates

/**
 * @Template("base.html.twig")
 */

nor the @ namespaced syntax

/**
 * @Template("@App/base.html.twig")
 */

This used to work in previous versions. Again, this doesn't seem related to #450, as this issue here also happens in regular @Template annotations and ->render() calls.

screen shot 2015-08-23 at 13 07 39

apfelbox commented 9 years ago

Is there any update on this one, @Haehnchen? This happens for every template in my codebase, as we exclusively use this notation.

f-palomares commented 8 years ago

I had a similar issue using a symlink for the base project path. Closing the project and opening with a direct path solved the issue for me Hope it helps