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

    Add bash-debug
---
 README.org |  8 ++++++++
 dape.el    | 27 +++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/README.org b/README.org
index 2ed364d04f..c4fcd34058 100644
--- a/README.org
+++ b/README.org
@@ -180,6 +180,14 @@ Install with ~opam install earlybird~.
 2. Place breakpoints inside of =_build/default/*=
 
 See [[https://github.com/hackwaly/ocamlearlybird][ocamlearlybird]] for more 
information.
+
+** Bash - bash-debug
+1. Install =node=
+2. Download latest =vsix= 
[[https://github.com/rogalmic/vscode-bash-debug/releases][release]] of DAP 
adapter =bash-debug-<version>.vsix=
+3. Unpack ~mkdir -p ~/.emacs.d/debug-adapters && unzip 
bash-debug-<version>.vsix -d ~/.emacs.d/debug-adapters/bash-debug~
+
+See [[https://github.com/rogalmic/vscode-bash-debug][bash-debug]] for more 
information.
+
 ** 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 97ff4583af..05148dcb2e 100644
--- a/dape.el
+++ b/dape.el
@@ -103,6 +103,33 @@
               (unless (plist-get config 'command)
                 (user-error "Missing `command' property")))
      :request "launch")
+    ,(let* ((extension-directory
+             (expand-file-name
+              (file-name-concat dape-adapter-dir "bash-debug" "extension")))
+            (bashdb-dir (file-name-concat extension-directory "bashdb_dir")))
+        `(bash-debug
+          modes (sh-mode bash-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 (,(file-name-concat extension-directory "out" 
"bashDebug.js"))
+          fn (lambda (config)
+               (thread-first config
+                             (plist-put :pathBashdbLib ,bashdb-dir)
+                             (plist-put :pathBashdb (file-name-concat 
,bashdb-dir "bashdb"))
+                             (plist-put :env `(:BASHDB_HOME ,,bashdb-dir . 
,(plist-get config :env)))))
+          :type "bashdb"
+          :cwd dape-cwd
+          :program dape-buffer-default
+          :args []
+          :pathBash "bash"
+          :pathCat "cat"
+          :pathMkfifo "mkfifo"
+          :pathPkill "pkill"))
     ,@(let ((codelldb
              `(ensure dape-ensure-command
                command-cwd dape-command-cwd

Reply via email to