Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin extension point #141

Open
Koc opened this issue Aug 17, 2013 · 7 comments
Open

Plugin extension point #141

Koc opened this issue Aug 17, 2013 · 7 comments

Comments

@Koc
Copy link
Contributor

Koc commented Aug 17, 2013

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
Copy link
Owner

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:

  • completion for FooInterfaceClass::getHelper('|tez|') configurable per xml as list "Method References"; create custom provider
  • return for getHelper is only possible on signature check, so need to know "FooInterfaceClass::getHelper" and classname of "VendorProjectsBundle:Custom", since its not possible to check for example docblock on type completion, this need configured external like xml or so
    similar to this plugin: https://github.com/pbyrne84/DynamicReturnTypePlugin

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
Copy link
Contributor Author

Koc commented Mar 12, 2014

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

@Haehnchen
Copy link
Owner

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
Copy link
Contributor Author

Koc commented Mar 15, 2014

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

@Koc
Copy link
Contributor Author

Koc commented Jul 30, 2014

@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:

  • support of multiple arguments
  • all rules for method wrapped into one item node

@Haehnchen
Copy link
Owner

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

@Haehnchen
Copy link
Owner

ref: Haehnchen/idea-php-toolbox#1

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

No branches or pull requests

2 participants