vscode-spell-checker icon indicating copy to clipboard operation
vscode-spell-checker copied to clipboard

Bug: `cSpell.addWordToDictionary` command with `args` still prompts for dictionary selection

Open lixoten opened this issue 4 months ago • 1 comments

🐛 Bug: cSpell.addWordToDictionary command with args still prompts for dictionary selection

Description

When using the cSpell.addWordToDictionary command with a specific dictionary name in the args property, the cSpell extension does not automatically add the word to the specified dictionary. Instead, it presents a "Select a dictionary" quick-pick menu, which defeats the purpose of the args parameter.

The expected behavior is for the command to bypass the prompt and directly add the word to the dictionary specified in the keybinding.

Steps to Reproduce

  1. Configure custom dictionaries in your settings.json file. Ensure addWords is set to true for at least two dictionaries.
    "cSpell.customDictionaries": {
        "dictionary-words": {
            "name": "dictionary-words",
            "path": "${workspaceFolder}/.cspell/dictionary-words.txt",
            "addWords": true,
            "scope": "user"
        },
        "dictionary-ignore": {
            "name": "dictionary-ignore",
            "path": "${workspaceFolder}/.cspell/dictionary-ignore.txt",
            "addWords": true,
            "scope": "user"
        }
    }
    
  2. Add a keybinding to your keybindings.json file. The args property must contain the name of one of the dictionaries from your settings.
    {
        "key": "ctrl+alt+i",
        "command": "cSpell.addWordToDictionary",
        "when": "editorTextFocus",
        "args": "dictionary-ignore"
    }
    
  3. Reload the VS Code window using the command Developer: Reload Window.
  4. Open a file and place the cursor on a misspelled word that cSpell has flagged.
  5. Press the assigned keyboard shortcut (Ctrl + Alt + I in this example).

Expected Behavior

The word at the cursor should be added directly to dictionary-ignore.txt without any prompts.

Actual Behavior

A quick-pick menu appears at the top of the editor, asking the user to select between "dictionary-ignore" and "dictionary-words". This extra step is not expected and prevents the keybinding from working as a single-step action.

Environment

  • VS Code Version: (e.g., 1.103.2)
  • cSpell Extension Version: (e.g., 4.0.47)
  • Operating System: (e.g., Windows 11)

lixoten avatar Aug 26 '25 07:08 lixoten

@lixoten,

Thank you for the suggestion. I was unaware that the args option existed on the keybindings.

Jason3S avatar Aug 26 '25 11:08 Jason3S