VSCodeVim / VSCodeVim/Vim

`when clause contexts` can not be expected to work

Open
#7,108 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
Use the following configuration at the same time, in any case only the second configuration works

To Reproduce

Add the following configuration to settings.json

        "vim.leader": "<space>",
        {
            "before": [
                "leader",
                "o",
                "t"
            ],
            "commands": [
                "testing.runAtCursor",
            ],
            "when": "resourceExtname == .java"
        },
        {
            "before": [
                "leader",
                "o",
                "t"
            ],
            "commands": [
                "workbench.action.tasks.runTask",
            ],
        },

Expected behavior

The first task is executed by default, and the second task is enabled in the java file

Screenshots

when type <space> o t in a .java file, the console logs

[Extension Host] Remapper: debug: normalModeKeyBindingsMap. match found. before= ,o,t. after=undefined. command=workbench.action.tasks.runTask. remainingKeys=. mapDepth=1.
  • Extension (VsCodeVim) version: v1.21.7
  • VSCode version: 1.60.2
  • OS: win10

Additional context

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two keybinding configurations in settings.json using a Java file and a non-Java file, then compare the remapper console log with the expected command selection. Done means the first command runs for .java files while the second command remains the default elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.