cspell icon indicating copy to clipboard operation
cspell copied to clipboard

New `add` words command option

Open CreativeTechGuy opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe.

There are cases where any misspelled words are almost surely intentional. For example when creating a new package based on a template, if the template includes cspell but the user arguments to that template include a word which cspell doesn't recognize, that causes unnecessary pain when getting started as they are immediately faced with errors. Similarly, when files are generated, the words in that file are likely to all be "correct" despite some being not identified by cspell.

Describe the solution you'd like

I'd like an option (like --fix) which will automatically add any identified words to the current config file's custom dictionary. It'd be great if cspell could be used programatically via a Node.js API and have a similar functionality.

Describe alternatives you've considered

To work around this problem as a template owner, I'd need to either add a cspell disable comment above every place that the user's template arguments will be placed throughout the codebase, disable cspell entirely and ask the user to re-enable it and fix errors upon starting, or implement the solution I've described on my own.

Additional context N/A

CreativeTechGuy avatar Jun 07 '21 03:06 CreativeTechGuy

Duplicate of #1297 #3

nschonni avatar Jun 07 '21 03:06 nschonni

I see some similarities. I believe the ability to amend an existing config via CLI/API has uses beyond an init script or simply ignoring errors.

My request is specifically to add valid words to the cspell.json's words list that cspell thought were errors but actually are not.

CreativeTechGuy avatar Jun 07 '21 06:06 CreativeTechGuy

Personally I would expect a —fix to actually fix spelling errors, not to update my configuration.

djmattyg007 avatar Jun 12 '22 00:06 djmattyg007

Personally I would expect a —fix to actually fix spelling errors, not to update my configuration.

I agree --fix would be best reserved for automatically fixing issues. I think something like add-words command with an --interactive mode would be useful.

cspell add-words --interactive "**/*.md"

Jason3S avatar Jun 12 '22 05:06 Jason3S