crane icon indicating copy to clipboard operation
crane copied to clipboard

I get this error on Mac when trying to install stubs

Open Strutsagget opened this issue 9 years ago • 17 comments

No handler found for the command: 'crane.downloadPHPLibraries'. An extension might be missing an activation event.

Strutsagget avatar Jul 08 '16 07:07 Strutsagget

It did work today when trying and wrote crane php stub.

Strutsagget avatar Jul 13 '16 06:07 Strutsagget

Odd, I'll do some investigation. Thanks for reporting this

nevadascout avatar Jul 13 '16 06:07 nevadascout

I did update VSC on June releases. (the second one released today?) Did not work(same error) on my colleague when i installed crane yesterday on his machine. on a fresh install of VSC.

Strutsagget avatar Jul 13 '16 07:07 Strutsagget

Which version of OS X is the machine that's not working running?

nevadascout avatar Jul 13 '16 07:07 nevadascout

I have the same error message on a fresh Win10 install, with fresh Visual Studio Code install. Stubs won't install.

hferradj avatar Jul 18 '16 11:07 hferradj

Forgot to mention that PHP Intellisense is also the 1st extension I installed and I actually didn't install any other.

hferradj avatar Jul 18 '16 11:07 hferradj

Got the same error on a Windows 10 as @AbuJunayd, someone just got a fix or a workaround?

nklasio avatar Jul 23 '16 10:07 nklasio

As a workaround you can download a zip of the stubs from here and place them in the C:/Users/[name]/AppData/Roaming/Crane/phpstubs/crane-php-stubs-master/ folder (you may have to create this folder)

Then press F1, type reindex and select the crane option to reindex the workspace.

nevadascout avatar Jul 23 '16 10:07 nevadascout

Thanks dude! You're welcome

nklasio avatar Jul 23 '16 10:07 nklasio

Getting this error on reindexing: No handler found for the command: 'crane.rebuildSources'. An extension might be missing an activation event.

nklasio avatar Jul 23 '16 10:07 nklasio

You need to open a php file before trying to reindex the workspace

nevadascout avatar Jul 23 '16 12:07 nevadascout

Same issue

The workaround of @nevadascout is wrong place the files in %APPDATA%\Crane\phpstubs\crane-php-stubs-master\

%APPDATA% resolves to C:\Users\AppData\Roaming

The path likely won't exist so just use [START] +[R] > explorer %APPDATA% or easier just run the following command:

[START]+[R] > cmd > mkdir %APPDATA%\Crane\phpstubs\

Then download the file https://codeload.github.com/HvyIndustries/crane-php-stubs/zip/master (the zip contains the last folder as described above and extract it into %APPDATA%\Crane\phpstubs\

After that you need to open a folder (your PHP project) and then [CTRL]+[SHIFT]+[R] to reindex crane.

Finally PHP autocomplete for vscode :+1:

vdoria avatar Aug 29 '16 12:08 vdoria

Oops, thanks for the correction @vdoria! I've updated my comment

nevadascout avatar Aug 29 '16 12:08 nevadascout

Also, the error message No handler found for the command: 'crane.downloadPHPLibraries' occurs because you haven't opened a php file to initialize the crane library. If you open a php file the crane library loads and the command then becomes executable.

This is true for any crane command.

TheColorRed avatar Aug 29 '16 15:08 TheColorRed

We could fix this with activation events :

https://code.visualstudio.com/docs/extensionAPI/activation-events#_activationeventsoncommand

We could enable plugin for all exposed commands so there will no need to open a PHP file in order to make it work.

ichiriac avatar Mar 22 '17 11:03 ichiriac

I think you would have to use.

"activationEvents": [
    "*"
]

However, would this attempt to start indexing files event if it isn't a php project?

TheColorRed avatar Mar 22 '17 15:03 TheColorRed

@TheColorRed you are right, using '*' will trigger the plugin at start (vscode says it's not a good practice), but using onCommand:crane.downloadPHPLibraries will trigger it only if the command is requested by the user...

Instead using *, we could define all shortcut commands that depends on php environements.

ichiriac avatar Mar 22 '17 19:03 ichiriac