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

Key F5 is assigned to 'run' and 'continue' simultaneously #14639

Open
laemmleint opened this issue Dec 17, 2024 · 4 comments
Open

Key F5 is assigned to 'run' and 'continue' simultaneously #14639

laemmleint opened this issue Dec 17, 2024 · 4 comments
Labels
debug issues that related to debug functionality keybindings issues related to keybindings

Comments

@laemmleint
Copy link

Bug Description:

The key F5 is assigned to 'run' and 'continue' by default. This leads to problems when it muss be decided which command should be applied.

Steps to Reproduce:

Take this python script:

a = 1
b = 2
c = 3
print('end')
  1. Make a breakpoint at line 3
  2. Press and hold F5
  3. Observe there are many debug sessions

press_and_hold_f5

Additional Information

  • Operating System: Windows 11
  • Theia Version: 1.56.2
@msujew msujew added keybindings issues related to keybindings debug issues that related to debug functionality labels Dec 17, 2024
@msujew
Copy link
Member

msujew commented Dec 17, 2024

Looks like we're missing a when context here to prevent the command from running if we're already in a debug session:

keybindings.registerKeybinding({
command: DebugCommands.START.id,
keybinding: 'f5'
});

VS Code is doing this similarly, see here.

@laemmleint
Copy link
Author

laemmleint commented Dec 17, 2024

Thank you @msujew for the fast response.
It seems there is no 'registerCommandAndKeybindingRule' in the Theia code.

I have a suggestion to change the Continue command:

registry.registerCommand(DebugCommands.CONTINUE, {
    execute: () => {
        if (this.manager.state === DebugState.Stopped) {
            // eslint-disable-next-line no-unused-expressions
            this.manager.currentThread && this.manager.currentThread.continue();
        }
    },
    // When there is a debug session, F5 should always be captured by this command
    isEnabled: () => this.manager.state !== DebugState.Inactive
});

@msujew
Copy link
Member

msujew commented Dec 17, 2024

It seems there is no 'registerCommandAndKeybindingRule' in the Theia code.

Well, they are two different services, so instead you would register commands and keybindings for those commands separately.

I have a suggestion to change the Continue command:

Note that the issue isn't so much that the CONTINUE command triggers, but rather that the START command triggers, even though a debugging session is already active.

Are you interested in contributing a pull request to this repo for the improvement?

@laemmleint
Copy link
Author

Yes. I'm interested in contributing a pull request. I will open it in a couple of minutes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality keybindings issues related to keybindings
Projects
None yet
Development

No branches or pull requests

2 participants