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
Added ability to config the trace file and line number #162
Changes from 7 commits
7e0b2cd
8d56549
09d7a1d
1a2c5fd
b803b9a
76e23d5
07d6005
12a96f1
907b283
ff672e6
5ec712e
e6500f9
606da5b
71ce739
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,4 +114,28 @@ public function getUrl($additionalParams = null) | |
|
||
return Url::toRoute($route); | ||
} | ||
|
||
/** | ||
* @param array $options The array with trace | ||
* | ||
* @return string the trace line | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing @SInCE |
||
* @since 2.0.7 | ||
*/ | ||
public function traceLink($options) | ||
{ | ||
if (!isset($options['text'])) { | ||
$options['text'] = "{$options['file']}:{$options['line']}"; | ||
} | ||
if ($this->module->traceLink === null) { | ||
return $options['text']; | ||
} | ||
if (is_callable($this->module->traceLink)) { | ||
return call_user_func($this->module->traceLink, $options, $this); | ||
} | ||
if (is_string($this->module->traceLink)) { | ||
return strtr($this->module->traceLink, ['{file}' => $options['file'], '{line}' => $options['line'], '{text}' => $options['text']]); | ||
} | ||
|
||
return null; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,25 @@ return [ | |
|
||
You will see a debugger toolbar showing at the bottom of every page of your application. | ||
You can click on the toolbar to see more detailed debug information. | ||
|
||
|
||
Open Files in IDE | ||
----- | ||
|
||
You can create a link to open files in your favorite IDE with this configuration: | ||
|
||
```php | ||
return [ | ||
'bootstrap' => ['debug'], | ||
'modules' => [ | ||
'debug' => [ | ||
'class' => 'yii\debug\Module', | ||
'traceLink' => '<a href="phpstorm://open?url={file}&line={line}">{file}:{line}</a>', | ||
], | ||
// ... | ||
], | ||
... | ||
]; | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest putting common IDE strings here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @samdark In fact, there is no a list of possible settings per IDE. The user is who sets the string when it does the setup in the operating system. There is a link that talks about this in the example I quoted: https://pla.nette.org/en/how-open-files-in-ide-from-debugger There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct, shortly described at #144 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. example symfony |
||
You must make some changes to your OS, see this example: https://github.com/aik099/PhpStormProtocol |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,8 +57,8 @@ | |
if (!empty($data['trace'])) { | ||
$query .= Html::ul($data['trace'], [ | ||
'class' => 'trace', | ||
'item' => function ($trace) { | ||
return "<li>{$trace['file']} ({$trace['line']})</li>"; | ||
'item' => function ($trace) use ($panel) { | ||
return '<li>' . $panel->traceLink($trace) . '</li>'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bashkarev really! my bad.... |
||
}, | ||
]); | ||
} | ||
|
@@ -75,7 +75,7 @@ | |
|
||
return $query; | ||
}, | ||
'format' => 'html', | ||
'format' => 'raw', | ||
'options' => [ | ||
'width' => '60%', | ||
], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its unclear how this string should look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, an example would be good.