My-Linux-Config
My-Linux-Config copied to clipboard
How to debug with neovim?
你好,我对 SpaceVim 不是很熟悉,我现在已经安装 SpaceVim、ccls,看了几遍你文档和官方文档,但还是有些无从下手,麻烦有时间解答一下。我想实现以下功能:
【1】 Python 光标位置显示定义 Common(类似于 VScode intelligence); 【2】 Python 带有有参数的 Debug。 【3】 可交互式的 Debug。
目前已有配置如下:
因为对 VIM 不是特别熟悉,请帮忙尽可能详细描述一下配置步骤。
【1】 Python 光标位置显示定义 Common(类似于 VScode intelligence);
这个功能我不知道是什么效果? 可以给我一个在 VScode 中间的截图吗 ?
【2】 Python 带有有参数的 Debug。 【3】 可交互式的 Debug。
其实我从来没有 DEBUG 过 Python 代码。在 vim 中间我尝试调试过 C 语言,后来就没有用了,现在一般是直接在终端中间使用 gdb,具体的尝试我在文档中间写过了。
On Mon, Mar 29, 2021 at 5:16 PM flyingTan @.***> wrote:
Assigned #14 https://github.com/Martins3/My-Linux-config/issues/14 to @Martins3 https://github.com/Martins3.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Martins3/My-Linux-config/issues/14#event-4520305115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7UY3DO7EUOCKUWXELDV2LTGBAPNANCNFSM4Z7F5PVQ .
调试这个东西我确实一直都没太注意,趁这次把这个修复一下也是极好的。关于调试的配置,你有找到什么资料或者想法吗 ?
On Mon, Mar 29, 2021 at 5:45 PM Bachelar Hu @.***> wrote:
【1】 Python 光标位置显示定义 Common(类似于 VScode intelligence);
这个功能我不知道是什么效果? 可以给我一个在 VScode 中间的截图吗 ?
【2】 Python 带有有参数的 Debug。 【3】 可交互式的 Debug。
其实我从来没有 DEBUG 过 Python 代码。在 vim 中间我尝试调试过 C 语言,后来就没有用了,现在一般是直接在终端中间使用 gdb,具体的尝试我在文档中间写过了。
On Mon, Mar 29, 2021 at 5:16 PM flyingTan @.***> wrote:
Assigned #14 https://github.com/Martins3/My-Linux-config/issues/14 to @Martins3 https://github.com/Martins3.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Martins3/My-Linux-config/issues/14#event-4520305115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7UY3DO7EUOCKUWXELDV2LTGBAPNANCNFSM4Z7F5PVQ .
很抱歉,我在这方面貌似没你专业,因为我平时用 VScode 等 IDE 比较多,所以现在用你配置有点棘手,有点无从下手。本质问题在与中间很多工作没做到位,所以向你请教一种循序渐进的方法。但是又没太多想法,只能硬看。
- 平时debug python 用的就是 ipdb,和gdb 差不多比较原始,高级用法我没涉猎。
问题不大,我周末的时候看看这个有没有好的解决方案。
On Mon, Mar 29, 2021 at 9:59 PM flyingTan @.***> wrote:
很抱歉,我在这方面貌似没你专业,因为我平时用 VScode 等 IDE 比较多,所以现在用你配置有点棘手,有点无从下手。本质问题在与中间很多工作没做到位,所以向你请教一种循序渐进的方法。,但是又没太多想法,只能硬看。
- 平时debug python 用的就是 ipdb,和gdb 差不多比较原始。高级用法我没涉猎。
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Martins3/My-Linux-config/issues/14#issuecomment-809399777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7UY3E7JKC5OX7IAQRY44LTGCBUFANCNFSM4Z7F5PVQ .
写一下我自己的想法:
- 两个框架的作者都是准备集成这个 vimspector 的
- https://github.com/SpaceVim/SpaceVim/issues/3294
- https://github.com/neoclide/coc.nvim/issues/322
- 我自己尝试了一些,配置并不是很难,主要是很多快捷键需要重新映射
➜ test git:(master) ✗ cat .vimspector.json
{
"configurations": {
"Vim - run a test": {
"adapter": "vscode-cpptools",
"configuration": {
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/a.out",
"args": [
],
"cwd": "${workspaceRoot}",
"environment": [
{ "name": "runtime", "value": "${workspaceRoot}/runtime" }
],
"externalConsole": true,
"stopAtEntry": true,
"MIMode": "gdb",
"logging": {
"engineLogging": false
}
}
}
}
}
- vimspector 的设计 vscode 很类似
- 在我的文中提到过几种 gdb 的强化产品,我个人感觉可以很大的挽救调试的体验,所以 vimspector 的使用并没有那么紧迫。
综合上面的内容,我不想自己写一个 vimspector 成为现在 coc.nvim / spsacevim 尚未集成 vimspector 的过渡品。
值得关注的项目:
- https://github.com/mfussenegger/nvim-dap
- https://github.com/rcarriga/nvim-dap-ui
- https://github.com/sakhnik/nvim-gdb
这个人花了三天才才配置好,看来到如今,在 nvim 中还是比较难集成调试https://www.reddit.com/r/neovim/comments/silikv/debugging_in_neovim/
https://github.com/Martins3/My-Linux-Config/tree/debug 在这个分支中简单测试 dap 的功能,基本上可以说是开箱即用,但是:
- ARM MAC 不支持
- nixos 不支持
- 需要引入超级多配置
- 引入非 mainstream 的插件
我建议如果没有额外的精力,可以再等一年
- https://github.com/jbyuki/one-small-step-for-vimkind
- https://github.com/nvim-lua/kickstart.nvim/blob/master/lua/kickstart/plugins/debug.lua
- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation