svaante / dape

Debug Adapter Protocol for Emacs
GNU General Public License v3.0
477 stars 31 forks source link

Wrong type argument: stringp, dape-cwd-fn #42

Closed gf3 closed 9 months ago

gf3 commented 10 months ago

When attempting to M-x dape I get the error: Wrong type argument: stringp, dape-cwd-fn

This is with the default config (with and without the sample projectile cwd fn) and go-ts-mode on emacs 30.0.50.

Debug

Output with (setq debug-on-error t)

Debugger entered--Lisp error: (wrong-type-argument stringp dape-cwd-fn)
  dape--config-ensure((modes (go-mode go-ts-mode) ensure dape-ensure-command fn (dape-config-autoport dape-config-tramp) command "dlv" command-args ("dap" "--listen" "127.0.0.1::autoport") command-cwd dape-cwd-fn port :autoport :request "launch" :type "debug" :cwd dape-cwd-fn :program dape-cwd-fn))
  dape--read-config()
  byte-code("\300 C\207" [dape--read-config] 1)
  command-execute(dape record)
  #<subr execute-extended-command>(nil "dape" "dape")
  ad-Advice-execute-extended-command(#<subr execute-extended-command> nil "dape" "dape")
  apply(ad-Advice-execute-extended-command #<subr execute-extended-command> (nil "dape" "dape"))
  execute-extended-command(nil "dape" "dape")
  funcall-interactively(execute-extended-command nil "dape" "dape")
  command-execute(execute-extended-command)
gf3 commented 10 months ago

I'm not familiar enough with dape/emacs to know if one of these referenced dape-cwd-fn is being passed as a string instead of a closure reference somewhere:

https://github.com/svaante/dape/blob/00b226369cc53509aaf368d97e981b8536ef2263/dape.el#L127-L138

gf3 commented 10 months ago

Also worth noting that when using the provided projectile dape-cwd-fn I am able to successfully call the function:

(funcall (symbol-value 'dape-cwd-fn))
; "/home/gianni/Code/github.com/freshlineapp/arowana/"
gf3 commented 10 months ago

I'm not sure if this is an emacs 30 thing, but it seems to be that default-directory expects a string. If I change this:

https://github.com/svaante/dape/blob/00b226369cc53509aaf368d97e981b8536ef2263/dape.el#L3461

to this:

      (let ((default-directory (or (funcall (plist-get config 'command-cwd))

then dape--config-ensure executes correctly, but other functions break afterwards.

akurth commented 10 months ago

I'm not sure if this is an emacs 30 thing

It isn’t. I have the same problem with 29.1.90, built daily from emacs-29 branch.

svaante commented 10 months ago

This is not an emacs thing, I broke go debugging with 4597ee6. It should be fixed now! Please get back to me if latest fix you issue!

akurth commented 10 months ago

For me it is fixed. Thanks a lot!

gf3 commented 9 months ago

I believe this issue is fixed now! Thank you.