Haehnchen / idea-php-symfony2-plugin

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

Plugin extension point #141

Open Koc opened 11 years ago

Koc commented 11 years ago

Hello dear developers!

How can I extends this plugin to add support of custom autocomplete? For example we have twig function:

{% set someHelper = brouzie_helper('VendorProjectsBundle:Custom') %}

which return instance of %VendorProjectsBundle%\Helper\CustomHelper where %VendorProjectsBundle% is a bundle namespace. So it would be nice to add 2 autocompletes here:

  1. autocomplete list of all possible helpers in function calls
  2. autocomplete public helper methods after variable {{ someHelper .{# ... #} }}

Also there is possible thing in php code:

<?php

$this->controller
    ->get('brouzie.helpers.helper_factory')
    ->getHelper('VendorProjectsBundle:Custom')->/* ... */

Ideally to extends without changing java code, via configuration or configuration files.

Haehnchen commented 11 years ago

i have similiar problems at worktime, iam trying to resolve it step by step, but most is limited by phpstorm api and currently not possible, but my plans:

twig should provide support also for "Method References". but in phpstorm6 twig api is a nightmare. in 7 the twig api stuff is completely rewritten. also contacted twig maintainer. hopefully they will implemented some of the wishes

Koc commented 10 years ago

@Haehnchen does something changed in the PHPStorm API for the last monthes?

Haehnchen commented 10 years ago

we have some more possibilities, but most work need to be done on our side. target is to remove deps on java and provide some more external configs see also #245.

i prefer to use some xml files with a unique name so we can index them.

quick example:

<item language="php" instance="\FooInterface" method="getHelper" value="VendorProjectsBundle:Custom">
  <return>\Foo\Class</return>
</item>
<item language="twig" function="brouzie_helper" value="VendorProjectsBundle:Custom">
  <return>\Foo\Class</return>
</item>

feel free to extend it :)

Koc commented 10 years ago

So after this I should just create php script which generates this xml and it will work? Sounds good.

Koc commented 10 years ago

@Haehnchen can you continue work on this feature, please?

IMHO structure can be changed into

<item language="php" instance="\FooInterface" method="getHelper">
  <rule>
    <argument>VendorProjectsBundle</argument>
    <return>\Foo\ClassOne</return>
  <rule>
  <rule>
    <argument>VendorProjectsBundle</argument>
    <argument>Custom</argument>
    <return>\Foo\ClassTwo</return>
  <rule>
</item>

It adds next pros:

Haehnchen commented 10 years ago

yes. much better. but i dont know when to go for integration right now...

Haehnchen commented 9 years ago

ref: https://github.com/Haehnchen/idea-php-toolbox/issues/1