zeuxisoo / php-slim-whoops

PHP whoops error on slim framework
131 stars 10 forks source link

[Request] Ability to add the resolver #30

Closed WilliamStam closed 3 years ago

WilliamStam commented 3 years ago

the setting for editor pretty much only lets you set the editor like "phpstorm" etc. but it doesnt include the option to add the "resolver" part

 $prettyPageHandler->setEditor($this->settings['editor']);

as in

$prettyPageHandler->addEditor( 'phpstorm', 'http://localhost:8091?message=%file:%line' );

on windows we dont have a native protocol for phpstorm, so using a plugin "remote call" we can trigger the same thing using the above resolver.

https://plugins.jetbrains.com/plugin/6027-remote-call

zeuxisoo commented 3 years ago

Sorry for the late reply, In this case, If you would like to set custom value for editor, you can pass callback function not default string from editor list. like:

$app->add(new WhoopsMiddleware([
    'editor' => function($file, $line) {
        return "http://localhost:8091?message=%file:%line";
    }
]));

More detail on the filp/whoops documentation, below the words Adding your own editor is simple:

WilliamStam commented 3 years ago

haha omg i missed it. i just saw the setEditor() thing on whoops checks its internal list and errors out if it doesnt exist. somehow i totaly missed the is_callable() on it.

if ( missed this part !is_callable($editor) and only saw this part && !isset($this->editors[$editor])) {

sorry bout that. pr closed as well haha i feel like a total dumb### now


could i suggest a documentation update for windows users for this? (altho its probably a more upstream thing - for whoops itself) took me a while of fighting registry things and jetbrains installing each update to new folders to eventually find the remote call plugin trick. might be useful for others