-
Notifications
You must be signed in to change notification settings - Fork 140
Debugging macros with Vimspector in Neovim
Gaël Écorchard edited this page Jun 2, 2023
·
1 revision
- In FreeCAD's Python console:
import debugpy
debugpy.configure(python="python")
debugpy.listen(5678)
- Configure Neovim to use
python
as file type for*.FCMacro
files:
In vimscript:
au BufNewFile,BufRead *.FCMacro setlocal filetype=python
In lua
vim.filetype.add({
extension = {
FCMacro = 'python',
},
})
- File
.vimspector.json
in a parent directory of the code to debug, for example~/.local/share/FreeCAD/Macro
:
{
"configurations": {
"Python: Remote Debug": {
"adapter": "multi-session",
"configuration": {
"name": "Python: Remote Debug",
"request": "attach",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}
}
}
}
- Launch Vimspector ( with Vimspector's "Human" key bindings), set breakpoints and launch the macro in FreeCAD. When asked use
localhost
for the host and 5678 for the port. Answer other questions to your liking.