Skip to content

Commit 3f81a4f

Browse files
authored
add support gdscript/godot4 DAP debugger (#730)
* add support gdscript/godot4 DAP debugger * Add CHANGELOG: Added dap-gdscript
1 parent aba8722 commit 3f81a4f

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Changelog
55
** 0.8
66
- [Breaking Change] Change debug provider names to match VS Code's naming: ~lldb~ to ~lldb-mi~ and ~codelldb~ to ~lldb~
7+
- Added ~dap-gdscript~
78
** 0.7
89
- [Breaking change] For ~dap-lldb.el~, change ~type~ to ~lldb-vscode~.
910
** 0.5

dap-gdscript.el

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
;;; dap-gdscript.el --- Debug Adapter Protocol mode for gdscript -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2023 xiliuya
4+
5+
;; Author: xiliuya <[email protected]>
6+
;; Keywords: languages
7+
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; You should have received a copy of the GNU General Public License
19+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+
;; URL: https://github.com/yyoncho/dap-mode
22+
;; Package-Requires: ((emacs "25.1") (dash "2.14.1") (lsp-mode "4.0"))
23+
;; Version: 0.1
24+
25+
;;; Code:
26+
27+
(require 'dap-mode)
28+
(require 'dap-utils)
29+
30+
31+
32+
(defcustom dap-gdscript-debug-port 6006
33+
"The port to the gdscript/godot4 debugger."
34+
:group 'dap-gdscript
35+
:type 'number)
36+
37+
(defcustom dap-gdscript-debug-host "127.0.0.1"
38+
"The host to the gdscript/godot4 debugger."
39+
:group 'dap-gdscript
40+
:type 'string)
41+
42+
43+
(defun dap-gdscript--populate-start-file-args (conf)
44+
"Populate CONF with the required arguments."
45+
(let ((conf (-> conf
46+
(dap--put-if-absent :host dap-gdscript-debug-host)
47+
(dap--put-if-absent :debugServer dap-gdscript-debug-port)
48+
(dap--put-if-absent :type "gdscript")
49+
(dap--put-if-absent :cwd default-directory)
50+
(dap--put-if-absent :name "Gdscript Debug")
51+
(dap--put-if-absent :args ""))))
52+
conf))
53+
54+
(dap-register-debug-provider "gdscript" #'dap-gdscript--populate-start-file-args)
55+
56+
(dap-register-debug-template "Gdscript Run Configuration"
57+
(list :type "gdscript"
58+
:cwd nil
59+
:request "launch"
60+
:program nil
61+
:name "Gdscript::Run"))
62+
63+
(provide 'dap-gdscript)
64+
;;; dap-gdscript.el ends here

0 commit comments

Comments
 (0)