Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python代码调试时,在dap-repl下调试指令不能用 #416

Closed
1 task
hhcwyx opened this issue Jan 12, 2023 · 3 comments
Closed
1 task

python代码调试时,在dap-repl下调试指令不能用 #416

hhcwyx opened this issue Jan 12, 2023 · 3 comments
Labels
dap Debug Adapter related issues invalid This doesn't seem right usage User-specific issues

Comments

@hhcwyx
Copy link

hhcwyx commented Jan 12, 2023

Version confirmation

  • Confirm

Neovim version

NVIM0.8.2

Operating system/version

archlinux,dwm

Terminal name/version

alacritty

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

debugpy是用pacman在终端里安装的,没有用mason安装debugpy,在调试python代码时,用快捷键比如(space+d+r)可以正常调试,但是在dap-repl窗口,用.next命令,就不正常,dap-repl窗口输出以下信息:
dap> .n
dap>
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 1195, in internal_evaluate_expression_json
pydevd_vars.evaluate_expression(py_db, frame, expression, is_exec=True)
File "/usr/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py", line 370, in new_func
return _run_with_unblock_threads(original_func, py_db, curr_thread, frame, expression, is_exec)
File "/usr/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py", line 334, in _run_with_unblock_threads
return _run_with_interrupt_thread(original_func, py_db, curr_thread, frame, expression, is_exec)
File "/usr/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py", line 305, in _run_with_interrupt_thread
return original_func(py_db, frame, expression, is_exec)
File "/usr/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py", line 548, in evaluate_expression
compiled = _compile_as_exec(expression)
File "/usr/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py", line 412, in _compile_as_exec
return compile(expression_to_evaluate, '', 'exec', _ASYNC_COMPILE_FLAGS)
File "", line 1
.n
^
SyntaxError: invalid syntax
dap>

是不是还需要其他设置呢?

Expected behavior

希望在dap-repl窗口下能用指令控制调试过程.

Actual behavior

No response

Additional information

No response

@hhcwyx hhcwyx added the bug Something isn't working label Jan 12, 2023
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Jan 12, 2023

You misunderstood the meaning of REPL.

A Read-Eval-Print Loop (REPL) is an interactive interpreter to a programming language. It originated with LISP systems, but many other languages (Python, Ruby, Haskell, Tcl, etc.) use REPL's to manage interactive sessions. They allow for simple experimentation with a language by bypassing the compile stage of the code -> compile -> execute cycle.

There are 4 components to a REPL:

  • A read function, which reads input from the keyboard
  • An eval function, which evaluates code passed to it
  • A print function, which formats and displays results
  • A loop function, which runs the three previous commands until termination

Source: https://www.cs.rpi.edu/academics/courses/fall00/ai/scheme/reference/schintro-v14/schintro_114.html

In short, it starts an interactive console where you can type in expressions and immediately see the result of these expressions.

REPL can't interact directly with your debugger (which means it can't send instructions directly) - this is done using DAP (Debug Adapter Protocol) (in nvim, nvim-dap) through exposed APIs.

@Jint-lzxy Jint-lzxy added invalid This doesn't seem right dap Debug Adapter related issues and removed bug Something isn't working labels Jan 12, 2023
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Jan 12, 2023

To view all available instructions, enter .help. Ideally, there will be command completion (depending on language-specific settings) when you enter .

@Jint-lzxy Jint-lzxy added the usage User-specific issues label Jan 12, 2023
@hhcwyx
Copy link
Author

hhcwyx commented Jan 12, 2023

@Jint-lzxy 非常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dap Debug Adapter related issues invalid This doesn't seem right usage User-specific issues
Projects
None yet
Development

No branches or pull requests

2 participants