Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke dape from elisp directly. #193

Open
Vighnesh-V opened this issue Jan 13, 2025 · 1 comment
Open

Invoke dape from elisp directly. #193

Vighnesh-V opened this issue Jan 13, 2025 · 1 comment

Comments

@Vighnesh-V
Copy link

Hi!

Apologies first off, because I am not super competent with elisp. I am working on a small function to invoke dape automatically after performing some additional parsing. When I invoke dape interactively (M-x dape), I can then type myTargetName :args [... some overrided args] and it launches dape. However, when I run dape in my elisp function like so:

(defun test ()
  (interactive)
  ;; Do some work to get some parameters 
  (dape `(myTargetName :args ["... some overrided args using the above parameter"]))
)

I get an error saying that the argument I passed is not a plist. Does there exist an easy way to call dape from elisp with the above arguments directly?

@svaante
Copy link
Owner

svaante commented Jan 15, 2025

Hello! Somewhat confusingly the interactive input to dape i.e. "Run adapter: ..." differs a bit form non interactive.

With interactive use (when you invoke dape as a command)
Dape takes the first symbol and looks up an config i dape-configs and takes the rest of the input and applies on to that configuration that resulting object is the PLIST config which (dape config) is then called with (note that this mechanism does a lot of heavy lifting, like resolving functions and symbols).

So if you wanted to start debugging a go application in "~/go-project" you would need to evaluate:

(dape '( command "dlv"
         command-args ("dap" "--listen" "127.0.0.1::autoport")
         command-cwd "~/go-project"
         command-insert-stderr t
         port :autoport
         :request "launch"
         :type "debug"
         :cwd "."
         :program "."))

It's not optimal that these formats have diverged and it might be improved in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants