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
Macro support doesn't work #531
Comments
I use
|
Got some macros defined in my TestCase base class and they do not get picked up either. What is the way to get our macros picked up by ide-helper? Any configuration parameter could help? |
Currently, macro support is implemented as part of facade alias processing, so the target class must be registered as a facade with an alias. (Eg included in Laravel has many classes that have the ability to define macro but not facade. (ex One workaround is to prepare appropriate aliases for those classes and add them to 'aliases' => [
......
'Collection' => \Illuminate\Support\Collection::class,
], Note: |
Find: Replace to And it will work :) (laravel 5.8) |
It doesn't seem to find macros in custom service providers.... Or at least it isn't for the Cache facade. |
@spencero91 were you able to figure this out? I've run into this situation where I've been curating macros definitions into an AutoCompleteHelper.php. That all works beautifully, however, if some macros are coming from different packages that are being used internally, if the next project has more macros or uses doesn't use all the macro's of the first file, you wind up having to manually curate that helper file. Extracting the helper file to the package seems like the obvious win, and it will work if you open the file up with phpstorm, and let it index it manually. However, if you make a change in the file in another IDE for example, to model something like a composer update where it changes behind the scenes, it won't update in PHPstorms index. If you do the same thing to the regular AutoCompleteHelper behind the scenes, it seems like it will update. This is probably a horrible solution, but the first thing that crosses my mind, is to add a command to composer dump-autoload that reads all packages for an AutoCompleteHelper.php, and then basically merge them into some safe space like config/autocomplete.php If anyone has solved this already and better please advise. EDIT |
I wrote a small package that uses some of the advice here to solve my own use case, which deals with TestCase Macros as well as macros in packages. It's not the coolest solution but it does work. you can find it at https://github.com/roni-estein/package-macro-autocomplete |
[Note i've previously posted this message as comment on the Macro feature PR but it seems i've got no visibility, hope this don't violate any rule ]
Unfortunately on my environment it doesn't works fine well... i'm on PhpStorm with laravel 5.3
i have this code in a custom registered provider (my code is working fine)
I see ide-helper correctly generate this in _ide_helper.php file
but the IDE don't recognize it in the autocomplete list.
when i write:
return response()->apiResp
the method is not listed in the autocomplete list, and if i write it completely like
return response()->apiResponse($result, [], false);
the method is underlined and marked with a tooltip sayng the method is not found
Do you have any idea?
The text was updated successfully, but these errors were encountered: