vscode-which-key icon indicating copy to clipboard operation
vscode-which-key copied to clipboard

Debug Transient State gets closed.

Open prochri opened this issue 3 years ago • 4 comments

Bug description

I am trying to create a debug transient state to help me debug. When I start debugging and trigger the step over command, the menu reappears for a short menu but then disappears, leaving me outside of the transient menu.

To Reproduce

  1. Add a which key transient menu, like this:
    "whichkey.transient": {
        "debug": {
            "title": "Debug transient",
            "bindings": [
                {
                    "key": "s",
                    "name": "Step over",
                    "icon": "debug-step-over",
                    "command": "workbench.action.debug.stepOver"
                }
// [...]
  1. Start debugging and stop at a breakpoint
  2. Open the transient menu
  3. Press 's' to step over

Expected behavior

The menu should be active after the step over is completed.

prochri avatar Nov 27 '22 10:11 prochri

Will take a look in a few weeks, I remembered I tried this a while back and something stopped me from using transient for the debug menu.

stevenguh avatar Dec 02 '22 18:12 stevenguh

Tinkering with waiting additional delay after command execution or with ignoreFocusOut option of QuickPick API.

I think this is what's happening...

  1. Awaiting workbench.action.debug.* only issue the command to LSP
  2. which-key then display the QuickPick menu.
  3. LSP comes back and steals the focus; hence, closes the QuickPick menu.

A workaround is to add some delay to each command, but this is not that reliable as the delay is probably from the LSP.

stevenguh avatar Dec 27 '22 04:12 stevenguh

I played around with this again trying to find a solution by tracking the DAP (not LSP when nitpicking!) state. While this kind of worked sometimes, I found a much better solution:

Setting the VSCode option debug.focusEditorOnBreak to false, should make the transient menu workas is in my initial tests!

prochri avatar Oct 10 '23 16:10 prochri

Interesting found! Reopen this for future investigation and then if that works well maybe update the default binding and documentations

stevenguh avatar Oct 11 '23 01:10 stevenguh