Skip to content

Commit 8ed07eb

Browse files
authored
Support editors when php.ini not available (php-debugbar#543)
1 parent 48c36d1 commit 8ed07eb

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/DebugBar/DataCollector/DataCollector.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,39 @@ public function getXdebugLinkTemplate()
189189
return $this->xdebugLinkTemplate;
190190
}
191191

192+
/**
193+
* @param string $editor
194+
*/
195+
public function setEditorLinkTemplate($editor)
196+
{
197+
$editorLinkTemplates = array(
198+
'sublime' => 'subl://open?url=file://%f&line=%l',
199+
'textmate' => 'txmt://open?url=file://%f&line=%l',
200+
'emacs' => 'emacs://open?url=file://%f&line=%l',
201+
'macvim' => 'mvim://open/?url=file://%f&line=%l',
202+
'phpstorm' => 'phpstorm://open?file=%f&line=%l',
203+
'phpstorm-remote' => 'javascript:let r=new XMLHttpRequest;' .
204+
'r.open("get","http://localhost:63342/api/file/%f:%l");r.send()',
205+
'idea' => 'idea://open?file=%f&line=%l',
206+
'idea-remote' => 'javascript:let r=new XMLHttpRequest;' .
207+
'r.open("get","http://localhost:63342/api/file/?file=%f&line=%l");r.send()',
208+
'vscode' => 'vscode://file/%f:%l',
209+
'vscode-insiders' => 'vscode-insiders://file/%f:%l',
210+
'vscode-remote' => 'vscode://vscode-remote/%f:%l',
211+
'vscode-insiders-remote' => 'vscode-insiders://vscode-remote/%f:%l',
212+
'vscodium' => 'vscodium://file/%f:%l',
213+
'nova' => 'nova://core/open/file?filename=%f&line=%l',
214+
'xdebug' => 'xdebug://%f@%l',
215+
'atom' => 'atom://core/open/file?filename=%f&line=%l',
216+
'espresso' => 'x-espresso://open?filepath=%f&lines=%l',
217+
'netbeans' => 'netbeans://open/?f=%f:%l',
218+
);
219+
220+
if (is_string($editor) && isset($editorLinkTemplates[$editor])) {
221+
$this->setXdebugLinkTemplate($editorLinkTemplates[$editor]);
222+
}
223+
}
224+
192225
/**
193226
* @param string $xdebugLinkTemplate
194227
* @param bool $shouldUseAjax

0 commit comments

Comments
 (0)