From f099b9d186771a98a3dbbb2d25ce529d6d02ba9b Mon Sep 17 00:00:00 2001 From: erikn69 Date: Mon, 17 Jul 2023 13:00:43 -0500 Subject: [PATCH] Support editors when php.ini not available --- src/DebugBar/DataCollector/DataCollector.php | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/DebugBar/DataCollector/DataCollector.php b/src/DebugBar/DataCollector/DataCollector.php index 5e3d52f2..36ef3425 100644 --- a/src/DebugBar/DataCollector/DataCollector.php +++ b/src/DebugBar/DataCollector/DataCollector.php @@ -182,6 +182,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