skip to Main Content

I want to remap hjkl to the arrow key in VSCode’s problems panel, but I couldn’t figure out the way. I’ve tried mapping list.focusUp and list.focusDown, but it doesn’t seem to work in the problems panel.

Related: VS Code – Remap certain arrow key functionality

2

Answers


  1. What you saw (and I see it too) is odd. It seems that list commands should work, see https://github.com/microsoft/vscode/issues/20440 where Problems have adopted the list focus commands…

    In any case, it is always wise to try a more restrictive when clause first.

    This works for me – I assume you have the focus in the Problems view already:

    {
      "key": "k",
      "command": "list.focusUp",
      "when": "workbench.panel.markers.view.active"
      //  "when": "focusedView == 'workbench.panel.markers.view'"  // or this
    },
    
    {
      "key": "j",
      "command": "list.focusDown",
      "when": "workbench.panel.markers.view.active"
      //  "when": "focusedView == 'workbench.panel.markers.view'"  // or this
    }
    

    I don’t know what you want the left/right to do in the Problems though.


    I see you have filed a GitHub issue:
    Bind directional hjkl for the Problems panel
    .

    Login or Signup to reply.
  2. I used the default when clause- listFocus && !inputFocus && !treestickyScrollFocused, which had the issue of the filter getting focus for typing when key had no modifiers. The asker raised an issue ticket at Bind directional hjkl for the Problems panel #211297, and the maintainers responded with this change, which prevents focusing the filter if soft-dispatching the keyboard event finds that more chords are needed to resolve potential keybindings, or if a matching keybinding is found. I.e. I think the following should work in the April 2024 release of VS Code (1.89):

    {
      "key": "k",
      "command": "list.focusUp",
      "when": "listFocus && !inputFocus && !treestickyScrollFocused",
    },
    
    {
      "key": "j",
      "command": "list.focusDown",
      "when": "listFocus && !inputFocus && !treestickyScrollFocused",
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search