dape.el: 不需要 lsp-mode 的 dap 客户端

大家有兴趣的可以尝试一下。

我的话基于命令行的 *db 已经用习惯了,暂时就先观望一下了。

7 个赞

现在开发本机运行的程序比较少, 此协议支持远程调试吗?

另外, 是不是要开启toolbar才好用? 会显示按钮吗? 按钮操作比较简单.

看了一下 在配置里是可以定义 host 和端口的,那应该是可以支持远程的?

至于按钮…调试需要啥按钮?不就那几个快捷键, f9打断点, f10 step over f11 step in f12 step out?

1 个赞

左边栏 上部 是有按扭的

调试界面印象最深的是VS, 按钮比较方便. 特别是悬浮按钮, 操作很方便.

对于emacs, 不管你当前在哪个子窗口, 按钮都能起作用, 而快捷键就不一定了, 可能得先切换到合适的窗口, 否则可能快捷键冲突.

在Emacs中用hydra或者transient可能更合适

4 个赞

:+1:界面看起来不错。

不过Emacs 中用 M-x gud-gdb 感觉挺好用了(python 用 M-x pdb)。

  (defun vmacs-dape--select-go-args ()
    (require 'which-func)
    (if (string-suffix-p "_test.go"   (buffer-name))
        (when-let* ((test-name (which-function))
                    (test-regexp (concat "^" test-name "$")))
          (if test-name
              `["-test.run" ,test-regexp]
            (error "No test selected")))
      (if  current-prefix-arg
          (vconcat (split-string (read-shell-command "args: " nil
                                                     (if (equal (car compile-history) "")
                                                         '(compile-history . 1)
                                                       'compile-history))))
        [])))

  ;; https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
  (defun vmacs-dape-test-p ()
    (if (string-suffix-p "_test.go"   (buffer-name))
        "test" "debug"))

  (defun vmacs-dape-relative-dir ()
    "Return the file directory relative to dape's cwd. This is used by Delve debugger."
    (if (string-suffix-p "_test.go"   (buffer-name))
        (concat "./" (file-relative-name
                      default-directory (funcall dape-cwd-fn)))
      (funcall dape-cwd-fn)))

  ;; inside your dape-config
  (add-to-list 'dape-configs
               `(delve
                 modes (go-mode go-ts-mode)
                 command "dlv"
                 command-cwd dape-cwd-fn
                 command-args ("dap" "--listen" "127.0.0.1:55878")
                 host "127.0.0.1"
                 port 55878
                 :type "go"
                 :name "go-debug"
                 :request "launch"
                 :mode vmacs-dape-test-p
                 :cwd dape-cwd-fn
                 :program vmacs-dape-relative-dir
                 :args vmacs-dape--select-go-args))

https://www.reddit.com/r/emacs/comments/17c48kx/dapeel_dap_client_that_does_not_rely_on_lspmode/ 根据这个帖子 撸了个 golang 的支持跑 test 也支持main 的配置 ,且C-u 时 可以支持传递额外的参数

1 个赞

M-x pdb 只能显示当前断点在哪一行呀,以及再带一个 repl, variables window, frame window之类的是都没有 :joy: 其实就是命令行的 pdb 稍微增强一些功能,和 dap 带来的丰富信息还是不能比。

不过我到现在也没搞明白怎么把 debugpy 的 dap attach 到一个正在运行的 python repl 里(readme有提到一嘴,但是太简略了),但是用 pdb 就可以做到😂 所以我确实直接用 pdb 命令行会更多一点。

大佬能否展开详聊?有个带图形界面的程序(pyside程序),在终端里敲调试命令可以跑起来,在emacs gud/realgud里就是不能显示图形界面。

我也没调试过pyside 程序,没什么经验可以分享。

你可以弄个小的例子试试,不行就给 Emacs 报个 Bug 反馈下。

dape 已经加入到 elpa.gnu.org了

2 个赞

试用了下,相当的赞!

有没前辈分享下ruby的配置方法

有没有 Java 的配置

1 个赞

现在还缺乏一个类似neovim下mason的工具,可以自动下载管理lsp服务器和dap服务器

等你添加进centaur emacs后我去抄抄 :joy:

已经进了,做了简单的配置,只支持29+。

2 个赞

请问dape怎么开启补全呢,用的lsp-bridge,按照dape主页“ And with (setq dape-buffer-window-arrangement 'gud) + corfu as completion-in-region-function”设置完,lspbridge的补全也出问题了

没太懂,dape 是debug用的,跟补全无关呀。你问问作者吧