Bug: `cSpell.addWordToDictionary` command with `args` still prompts for dictionary selection
🐛 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
- Configure custom dictionaries in your
settings.jsonfile. EnsureaddWordsis set totruefor 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" } } - Add a keybinding to your
keybindings.jsonfile. Theargsproperty must contain thenameof one of the dictionaries from your settings.{ "key": "ctrl+alt+i", "command": "cSpell.addWordToDictionary", "when": "editorTextFocus", "args": "dictionary-ignore" } - Reload the VS Code window using the command
Developer: Reload Window. - Open a file and place the cursor on a misspelled word that cSpell has flagged.
- Press the assigned keyboard shortcut (
Ctrl + Alt + Iin 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,
Thank you for the suggestion. I was unaware that the args option existed on the keybindings.