Open LemonBreezes opened 8 months ago
I just came up with a hacky advice to work around this:
(defun cae-dap-debug-pass-envrc-a (args)
(when (length= (plist-get (car args) :environment) 0)
(plist-put (car args) :environment
(apply #'vector
(mapcar (lambda (s)
(let ((m (string-match "=" s)))
(if m
(list :name
(substring-no-properties s 0 m)
:value
(substring-no-properties s (1+ m)
(length s)))
(list :name s
:value ""))))
process-environment))))
args)
(advice-add #'dap-start-debugging-noexpand :filter-args
#'cae-dap-debug-pass-envrc-a)
Maybe we can add something like this to the package. An option to propagate the program being debugged.
dap-mode
is not launching my program with the environment variables I set in my.envrc
and have set buffer-local to my code files usingdirenv
. Related issues: https://github.com/emacs-lsp/lsp-mode/issues/2583, https://github.com/purcell/envrc/issues/71.