-
Notifications
You must be signed in to change notification settings - Fork 183
/
dap-ruby.el
60 lines (46 loc) · 2.19 KB
/
dap-ruby.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
;;; dap-ruby.el --- Debug Adapter Protocol mode for Ruby -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Ivan Yonchovski
;; Author: Ivan Yonchovski <[email protected]>
;; Keywords: languages
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Adapter for https://github.com/rubyide/vscode-ruby
;;; Code:
(require 'dap-mode)
(require 'dap-utils)
(defcustom dap-ruby-debug-path (expand-file-name "vscode/rebornix.Ruby" dap-utils-extension-path)
"The path to ruby vscode extension."
:group 'dap-ruby
:type 'string)
(defcustom dap-ruby-debug-program `("node"
,(f-join dap-ruby-debug-path "extension/dist/debugger/main.js"))
"The path to the ruby debugger."
:group 'dap-ruby
:type '(repeat string))
(dap-utils-vscode-setup-function "dap-ruby" "rebornix" "Ruby" dap-ruby-debug-path)
(defun dap-ruby--populate-start-file-args (conf)
"Populate CONF with the required arguments."
(-> conf
(dap--put-if-absent :dap-server-path dap-ruby-debug-program)
(dap--put-if-absent :type "Ruby")
(dap--put-if-absent :cwd default-directory)
(dap--put-if-absent :program (buffer-file-name))
(dap--put-if-absent :name "Ruby Debug")))
(dap-register-debug-provider "Ruby" 'dap-ruby--populate-start-file-args)
(dap-register-debug-template "Ruby Run Configuration"
(list :type "Ruby"
:cwd nil
:request "launch"
:program nil
:name "Ruby::Run"))
(provide 'dap-ruby)
;;; dap-ruby.el ends here