Skip to content

Send code to debug window #570

Closed

Description

@krlmlr

Is your feature request related to a problem? Please describe.
In a debugging session with https://github.com/ManuelHentschel/VSCode-R-Debugger, Ctrl + Enter still sends code to the R session.

Describe the solution you'd like
Ctrl + Enter sends to the debug window if inDebugMode.

Describe alternatives you've considered
I have mapped editor.debug.action.selectionToRepl to Ctrl + Enter if inDebugMode is set. This works but I need to select the code I want to send. I'd like to take advantage of this extension's ability to detect the R code to send to the debug window.

Additional context
Thanks for the great extension!

Activity

  1. krlmlr commented on Mar 17, 2021

    @krlmlr
    ContributorAuthor

    @ManuelHentschel Does this require help from VSCode-R-Debugger? AFAICT the Python extension has a similar command: microsoft/vscode-python#14494.

  2. krlmlr commented on Mar 17, 2021

    @krlmlr
    ContributorAuthor

    I changed the "when" for Ctrl+Enter to include !inDebugMode, now I can select code and press Ctrl + Enter to send code to the debug console. The default command "editor.debug.action.selectionToRepl" does that. It would be great if this extension enhanced this to send the current line and/or expression to the REPL.

    Do we need help from the R language server (or does this even belong there)?

    CC @renkun-ken.

  3. ManuelHentschel commented on Mar 17, 2021

    @ManuelHentschel
    Member

    @ManuelHentschel Does this require help from VSCode-R-Debugger? AFAICT the Python extension has a similar command: microsoft/vscode-python#14494.

    Ideally, this should be possible without any changes to VSCode-R-Debugger, using something similar to the command editor.debug.action.selectionToRepl or debug.replPaste. It's a bit annoying that there seems to be no command to send arbitrary text to the repl, just the selection/clipboard.

    A workaround might be to determine which code to send, using the existing functions from this package, then quickly select that text, call editor.debug.action.selectionToRepl and revert the selection (or accordingly using the clipboard, though at first glance that command only seems to paste the code without running it).

  4. krlmlr commented on Mar 17, 2021

    @krlmlr
    ContributorAuthor

    Yeah, I forgot about "editor.debug.action.selectionToRepl". AFAICT this commands sends and executes, at least after I mark the line with Ctrl + L.

    Can an extension send arbitrary text to the REPL?

  5. ManuelHentschel commented on Mar 17, 2021

    @ManuelHentschel
    Member

    Can an extension send arbitrary text to the REPL?

    Not as far as I'm aware. An extension can send custom commands to a debug session, using vscode.DebugSession.customRequest or access any of the normal commands, but there seems to be no command/function to send arbitrary text.

    A workaround might be to determine which code to send, using the existing functions from this package, then quickly select that text, call editor.debug.action.selectionToRepl and revert the selection (or accordingly using the clipboard, though at first glance that command only seems to paste the code without running it).

    This could be implemented by the vscode-R extension instead, but feels a bit hacky.

  6. Sandy4321 commented on Jul 22, 2022

    @Sandy4321

    will it work for python debugging ?
    Send code to debug window for current code line with cursor

  7. Sandy4321 commented on Jul 22, 2022

    @Sandy4321

    like
    https://www.youtube.com/watch?v=VXJChVF28jw
    How To Run Selected Lines In VS Code (Visual Studio Code)

    how to find exact text to update key binding json file ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions