phpstorm autocomplete variables from inluded/required files

Loving phpstorm 9 ... great work!

My question is fairly simple:

File 1: /inc/file1.php
<?php
$apples = 1;

File 2: /index.php
<?php
require 'inc/file1.php';
$xyz = $app...


When typing $app in File 2, it does not autocomplete to $apples. If I type in $apples; and then command-click on it, it opens file1.php and takes me to the declaration. At times, atl+/ will cycle through variables from include files, but this isnt nearly as good as autocomplete. If I place a class or function in file1.php, file2 will autocomplete that just fine.  I have tried things like Invalidating Caches and playing with Directory assignments in my project with no luck. Is there something I am missing or is this just not available??

Thanks a bunch!

2 comments
Comment actions Permalink

Okay, after a bunch of fooling around I found this solution.

ctrl + <space>  (twice)

This provides completion on variables that are within project scope. It would be nice to have it in a more available workflow, but this will do in a pinch. If anyone knows of a better solution, please let me know.

Thanks

0
Comment actions Permalink

Getting there .... I created a new macro by:

1. Edit - Macros - Start Macro Recording
2. type the following:  ctrl + <space> (twice)
3. Edit - Macros - Stop Macro Recording
4. Give the macro a name like "var_completion"
5. Edit - Macros - Edit Macros
6. Click the macro you just created and make sure it has only 2 lines (delete any extras):
          Action: CodeCompletion
          Action: CodeCompletion
7. Now open Preferences - Keymap and search for your new macro and assign a single key to it. I assigned CMD + M and overwrote the current use of that combination.

Hope this helps someone, and if you have any better ways of doing this let me know.

Cheers

0

Please sign in to leave a comment.