-
Notifications
You must be signed in to change notification settings - Fork 163
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
pythonas file type for*.FCMacrofiles:
In vimscript:
au BufNewFile,BufRead *.FCMacro setlocal filetype=pythonIn lua
vim.filetype.add({
extension = {
FCMacro = 'python',
},
})- File
.vimspector.jsonin 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
localhostfor the host and 5678 for the port. Answer other questions to your liking.