Skip to content

Commit

Permalink
Support editors when php.ini not available (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Aug 18, 2023
1 parent 48c36d1 commit 8ed07eb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/DebugBar/DataCollector/DataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,39 @@ public function getXdebugLinkTemplate()
return $this->xdebugLinkTemplate;
}

/**
* @param string $editor
*/
public function setEditorLinkTemplate($editor)
{
$editorLinkTemplates = array(
'sublime' => 'subl://open?url=file://%f&line=%l',
'textmate' => 'txmt://open?url=file://%f&line=%l',
'emacs' => 'emacs://open?url=file://%f&line=%l',
'macvim' => 'mvim://open/?url=file://%f&line=%l',
'phpstorm' => 'phpstorm://open?file=%f&line=%l',
'phpstorm-remote' => 'javascript:let r=new XMLHttpRequest;' .
'r.open("get","http://localhost:63342/api/file/%f:%l");r.send()',
'idea' => 'idea://open?file=%f&line=%l',
'idea-remote' => 'javascript:let r=new XMLHttpRequest;' .
'r.open("get","http://localhost:63342/api/file/?file=%f&line=%l");r.send()',
'vscode' => 'vscode://file/%f:%l',
'vscode-insiders' => 'vscode-insiders://file/%f:%l',
'vscode-remote' => 'vscode://vscode-remote/%f:%l',
'vscode-insiders-remote' => 'vscode-insiders://vscode-remote/%f:%l',
'vscodium' => 'vscodium://file/%f:%l',
'nova' => 'nova://core/open/file?filename=%f&line=%l',
'xdebug' => 'xdebug://%f@%l',
'atom' => 'atom://core/open/file?filename=%f&line=%l',
'espresso' => 'x-espresso://open?filepath=%f&lines=%l',
'netbeans' => 'netbeans://open/?f=%f:%l',
);

if (is_string($editor) && isset($editorLinkTemplates[$editor])) {
$this->setXdebugLinkTemplate($editorLinkTemplates[$editor]);
}
}

/**
* @param string $xdebugLinkTemplate
* @param bool $shouldUseAjax
Expand Down

0 comments on commit 8ed07eb

Please sign in to comment.