Skip to content

Commit

Permalink
Support editors when php.ini not available
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 committed Jul 17, 2023
1 parent 0a35325 commit 9fd3615
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/DebugBar/DataCollector/DataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ abstract class DataCollector implements DataCollectorInterface
protected $xdebugLinkTemplate = '';
protected $xdebugShouldUseAjax = false;
protected $xdebugReplacements = array();
protected $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',
);

/**
* Sets the default data formater instance used by all collectors subclassing this class
Expand Down Expand Up @@ -182,6 +202,17 @@ public function getXdebugLinkTemplate()
return $this->xdebugLinkTemplate;
}

/**
* @param string $editor
* @param bool $shouldUseAjax
*/
public function setEditorLinkTemplate($editor)
{
if (is_string($editor) && ! empty($editor)) {
$this->setXdebugLinkTemplate($this->editorLinkTemplates[$editor]);
}
}

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

0 comments on commit 9fd3615

Please sign in to comment.