Key F5 is assigned to 'run' and 'continue' simultaneously
Opened this issue · 4 comments
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')
- Make a breakpoint at line 3
- Press and hold F5
- Observe there are many debug sessions
Additional Information
- Operating System: Windows 11
- Theia Version: 1.56.2
Looks like we're missing a when
context here to prevent the command from running if we're already in a debug session:
theia/packages/debug/src/browser/debug-frontend-application-contribution.ts
Lines 1012 to 1015 in 4e3b183
VS Code is doing this similarly, see here.
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
});
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?
Yes. I'm interested in contributing a pull request. I will open it in a couple of minutes...