Skip to content

Extension API - How to determine debug state #10077

Closed

Description

Dear vscode-team

I've got another question for you guys.
Is there any possibility to determine if VSCode is actually debugging?

My idea is to do something like this:

If a file changes, AND vscode is in debug mode (with f5), I want to run a certain command.

As I'm aware of, one can define a when on a key binding but is this possible from the extension API?

Cheers
Chris

Activity

  1. isidorn commented on Aug 3, 2016

    @isidorn

    Yes there is a "when": "inDebugMode", however not sure if we surface when in our api or if we want to add that.
    Thus forwarding to Johannes Rieken (@jrieken)

  2. buehler commented on Aug 3, 2016

    @buehler
    Author

    It would be a nice feature actually (if it's not already possible)
    So one could add special behavior for certain actions.

    Like, if my file changes and vscode is actually in debugging mode (or in a debugging session) I'd run the command workspace.debug.restart (just as an example, I know the actual command does have another name)

  3. jrieken commented on Aug 4, 2016

    @jrieken
    Contributor

    The when clause is not the right vehicle for this because it's just a condition under which commands are constraint by default. However, a user can always change things like a keybinding and skip/change the when clause as she/he likes.

    What you want is debugging API like a vscode.debugger-namespace which have we not yet planned to do.

  4. added
    debug
    on Aug 4, 2016
  5. buehler commented on Aug 4, 2016

    @buehler
    Author

    Yeah such a namespace would be nice to determine the state of vscode.

    Something like vscode.debugger.isDebugging() maybe?

    I would like to suggest this feature then 😄
    IMO it could be very beneficial for some extensions to add features and / or behaviors based on the state of VSCode.

    For now, I just can execute the command for restarting the debugger and see if there's an error.

  6. added
    feature-request
    on Aug 4, 2016
  7. jrieken commented on Nov 17, 2017

    @jrieken
    Contributor

    There is now debug api that allows you to do this. Please try it out and provide in detail feedback. Thanks

  8. locked and limited conversation to collaborators on Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apidebugfeature-request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions