Comments (17)
Here's how to make it work with debugpy
:
Alternative: Use debugpy directly
If you can't get a node 10 envirinment set up for whatver reason, then you can
avoid that issue by using debugpy
(formerly ptvsd
directly).
Here's how:
- Instal
debugpy
:pip install debugpy
- Create
/path/to/vimspector/gadgets/<os>/.gadgets.d/debugpy.json
:
{
"adapters": {
"debugpy": {
"command": [
"python",
"-m",
"debugpy.adapter"
],
"name": "debugpy",
"configuration": {
"python": "python"
}
}
}
}
Then in theory you should just have to change "adapter": "vscode-python"
to
"adapter": "debugpy"
.
I tested this and it works for me.
from vimspector.
Itβs a(nother) neovim missing feature. Apparently it works with master but π€·ββοΈ
from vimspector.
I pushed a PR to make it work in neovim. le sigh.
from vimspector.
You need to use node < 13. I recommend nvm use 10
This is a bug/incompatibility of the python debug adapter from Microsoft
from vimspector.
The debugger works in vscode though, is that expected with node > 13?
from vimspector.
I expect vscode is bundling node. You need a version of node that will run the DA.
from vimspector.
All vimspector is doing is running this:
"node" "/Users/eyalkarni/vimpy3/pack/vimspector/opt/vimspector/gadgets/macos/vscode-python/out/client/debugger/debugAdapter/main.jsβ
If you can see vscode doing something different let me know.
from vimspector.
re-opening as this doesn't affect VSCode and there's a meaninful possibility that https://github.com/microsoft/vscode-python/issues/9829 won't be fixed.
from vimspector.
There is however a workaround, you can use ptvsd
directly instead of vscode-python
. It requires different launch configuration, but it does work and doesn't rely on nodejs.
You'll have to work out the adapter
configuration for that yourself, but i think this is where the vscode-python
starts up ptvsd
from vimspector.
Thanks, I'll take a look at this later
from vimspector.
I might take a look at configuring it myself, but I didn't understand much of what was being said in the ptvsd thread, so it'll be a dedicated project in itself some other time.
Is there much chance you will end up switching it yourself once the standalone version is released?
from vimspector.
Thank you!
from vimspector.
I understand that neovim isn't really supported, but this particular adapter worked fine on vim but not neovim. Are you willing to offer any suggestions?
E+00000.022: Error parsing 'DEBUGPY_LAUNCHER_POR
T':
Traceback (most recent call last):
File "/home/user/.local/lib/py
thon3.8/site-packages/debugpy/launcher/__main__.
py", line 36, in option
return type(os.environ.pop(name
, *args))
File "/usr/lib/python3.8/_collect
ions_abc.py", line 795, in pop
value = self[key]
File "/usr/lib/python3.8/os.py",
line 673, in __getitem__
raise KeyError(key) from None
KeyError: 'DEBUGPY_LAUNCHER_PORT'
Stack where logged:
File "/usr/lib/python3.8/runpy.py
", line 193, in _run_module_as_main
return _run_code(code, main_glo
bals, None,
File "/usr/lib/python3.8/runpy.py
", line 86, in _run_code
exec(code, run_globals)
File "/home/user/.local/lib/py
thon3.8/site-packages/debugpy/launcher/__main__.
py", line 80, in <module>
main()
File "/home/user/.local/lib/py
thon3.8/site-packages/debugpy/launcher/__main__.
py", line 40, in main
launcher_port = option("DEBUGPY
_LAUNCHER_PORT", int)
File "/home/user/.local/lib/py
thon3.8/site-packages/debugpy/launcher/__main__.
py", line 38, in option
raise log.exception("Error pars
ing {0!r}:", name)
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 193,
in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 86, i
n _run_code
exec(code, run_globals)
File "/home/user/.local/lib/python3.8/site-
packages/debugpy/launcher/__main__.py", line 80,
in <module>
main()
File "/home/user/.local/lib/python3.8/site-
packages/debugpy/launcher/__main__.py", line 40,
in main
launcher_port = option("DEBUGPY_LAUNCHER_POR
T", int)
File "/home/user/.local/lib/python3.8/site-
packages/debugpy/launcher/__main__.py", line 38,
in option
raise log.exception("Error parsing {0!r}:",
name)
File "/home/user/.local/lib/python3.8/site-
packages/debugpy/launcher/__main__.py", line 36,
in option
return type(os.environ.pop(name, *args))
File "/usr/lib/python3.8/_collections_abc.py",
line 795, in pop
value = self[key]
File "/usr/lib/python3.8/os.py", line 673, in
__getitem__
raise KeyError(key) from None
KeyError: 'DEBUGPY_LAUNCHER_PORT'
[Process exited 1]
from vimspector.
Please see the note in the README.
from vimspector.
Way of the future
from vimspector.
TL;DR TLDR (Vim only, no NeoVim)
Vim
>= 8.2 &&Node
>= 11
$ [[ $(vim --version 2>&1) =~ "Vi IMproved 8."[2-9] ]] || echo "update VIM"
$ [[ $(node --version 2>&1) =~ v1[1-9] ]] || echo "update Node OR follow no more steps of this github-comment"
-
Install Plug, see docu
E.g. if junegunn/vim-plug: addPlug 'puremourning/vimspector'
to~/.vimrc
. Run:PlugInstall
. Run:source ~/.vimrc
-
do NOT run
:VimspectorInstall debugpy
-
debug with venv-
debugpy
Create/path/to/vimspector/gadgets/<os>/.gadgets.d/debugpy.json
E.g. if vim-plugger junegunn/vim-plug && OS GNU-Linux:
$ dir01="$HOME/.vim/plugged/vimspector/gadgets/linux/.gadgets.d"
$ mkdir -p $dir01
$ vim $dir01/debugpy.json
Paste and save:
{
"adapters": {
"debugpy": {
"command": [
"python",
"-m",
"debugpy.adapter"
],
"name": "debugpy",
"configuration": {
"python": "python"
}
}
}
}
-
$ [activate venv] && pip3 install debugpy
--> !!! in every new venv !!! -
$ vim [projectDirectory]/.vimspector.json
--> !!! in every new project !!!
Paste and save:
{
"configurations": {
"univisal: Launch": {
"adapter": "debugpy",
"configuration": {
"name": "<name>: Launch",
"type": "python",
"request": "launch",
"cwd": "${workspaceRoot}",
"stopOnEntry": true,
"console": "externalTerminal",
"debugOptions": [],
"program": "${file}"
}
}
}
}
-
$ vim [py file]
and activate venv (where you pip-installeddebugpy
)
E.g. jmcantrell/vim-virtualenv -->:VirtualEnvActivate <tab>
-
launch the awesome
Vimspector
-->:call vimspector#Launch()
from vimspector.
Why? Or just use vimspector to install debugpy. What is the purpose of all that effort?
from vimspector.
Related Issues (20)
- netcoredbg: macos arm64 archive contains x86_64 build HOT 2
- Virtual env `bin/python` buffer remains open after `:VimspectorReset` HOT 8
- [Feature Request]: Deprecate and remove 'tarball' install
- [Nvim Install without GUI] python3/vimspector/installer.py report room HOT 2
- vimspector#Launch() fails with Invalid Option Name "winbar" HOT 2
- [Feature Request]: Do not open source file if the file does not exists HOT 2
- Variables in nested block scopes not displaying as expected HOT 4
- [Feature Request]: Ability to debug "as root" HOT 2
- Vimspector Launch server timout
- What about a platformio integration? HOT 1
- RunToCursor mapping is missing for s:mappings == VISUALSTUDIO HOT 2
- windows neovim cannot add watch variable (error at self.expression[ 'frameId' ] = frame[ 'id' ]) HOT 3
- How to use vscode-java-debug adapter to debug java application HOT 3
- `Vimspector not connected error` on fresh install HOT 14
- [Bug]: netcoredbg exception breakpoints are not working HOT 1
- Launching a debug session I always get "Process exited with code -1." HOT 2
- omnicompletion not working HOT 2
- omnicompletion not working yet HOT 6
- [Feature Request]: Auto update the watched vars' value while program is running HOT 1
- NVim Lazy vimspector `vim/_editor.lua:0: nvim_exec2(): Vim(packadd):E919: Directory not found in 'packpath': "pack/*/opt/vimspector" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vimspector.