Skip to content

Commit 4b11121

Browse files
committed
Don't break existing `dap-go' installations
`dap-go-debug-program' `defcustom': if the old adapter is still present, warn and fall back to using it. Otherwise, use the new adapter path in. Computing the adapter path and warning anywhere other than the `dap-go-debug-program' would be fraught with corner cases, since users could customize that variable to point whereever they want, and `dap-go-debug-path' wouldn't necessary contain the adapter actually used.
1 parent 339bb84 commit 4b11121

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dap-go.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@
3535
:group 'dap-go
3636
:type 'string)
3737

38-
(defcustom dap-go-debug-program `("node"
39-
,(f-join dap-go-debug-path "extension/dist/debugAdapter.js"))
38+
(defcustom dap-go-debug-program
39+
`("node"
40+
,(let ((old (f-join dap-go-debug-path "extension/out/src/debugAdapter/goDebug.js"))
41+
(new (f-join dap-go-debug-path "extension/dist/debugAdapter.js")))
42+
(if (f-exists? old)
43+
(progn
44+
(lsp--warn "Go debug adapter is outdated; some features will not work properly")
45+
old)
46+
new)))
4047
"The path to the go debugger."
4148
:group 'dap-go
4249
:type '(repeat string))

0 commit comments

Comments
 (0)