branch: externals/dape
commit 45b547397a7d79ecce2c285e9fb8ceb80c1fcae7
Author: Daniel Pettersson <[email protected]>
Commit: Daniel Pettersson <[email protected]>

    Add baseline for PHP Xdebug config and install instructions
    
    Resolves #127
---
 README.org |  6 ++++++
 dape.el    | 19 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 3b39daee5e..2639115bcf 100644
--- a/README.org
+++ b/README.org
@@ -168,6 +168,12 @@ Extend ~eglot-server-programs~ as follows to have JDTLS 
load the plugin:
                   (:bundles 
["/PATH/TO/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-VERSION.jar"]))))
 #+end_src
 
+** PHP - Xdebug
+1. Install and setup =Xdebug= see 
[[https://github.com/xdebug/vscode-php-debug][instructions]]
+2. Install =node=
+3. Download latest =vsix= 
[[https://github.com/xdebug/vscode-php-debug/releases][release]] of DAP adapter 
for =Xdebug= =php-debug-<version>.vsix=
+4. Unpack ~mkdir -p ~/.emacs.d/debug-adapters && unzip 
php-debug-<version>.vsix -d ~/.emacs.d/debug-adapters/php-debug~
+
 ** Other untested adapters
 If you find a working configuration for any other debug adapter please submit 
a PR.
 
diff --git a/dape.el b/dape.el
index af3bf8095c..3452304b1b 100644
--- a/dape.el
+++ b/dape.el
@@ -386,7 +386,24 @@
      :request "launch"
      :vmArgs " -XX:+ShowCodeDetailsInExceptionMessages"
      :console "integratedConsole"
-     :internalConsoleOptions "neverOpen"))
+     :internalConsoleOptions "neverOpen")
+    (xdebug
+     modes (php-mode php-ts-mode)
+     ensure (lambda (config)
+              (dape-ensure-command config)
+              (let ((dap-debug-server-path
+                     (car (plist-get config 'command-args))))
+                (unless (file-exists-p dap-debug-server-path)
+                  (user-error "File %S does not exist" 
dap-debug-server-path))))
+     command "node"
+     command-args (,(expand-file-name
+                     (file-name-concat dape-adapter-dir
+                                       "php-debug"
+                                       "extension"
+                                       "out"
+                                       "phpDebug.js")))
+     :type "php"
+     :port 9003))
    "This variable holds the dape configurations as an alist.
 In this alist, the car element serves as a symbol identifying each
 configuration.  Each configuration, in turn, is a property list (plist)

Reply via email to