drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar
Apache License 2.0
314 stars 32 forks source link

Use directives of "Code Spell Checker" for Visual Code #333

Open crjeder opened 1 week ago

crjeder commented 1 week ago

For Visual Code there is a quite popular spell checker plug-in which uses in document settings like:

// spell-checker:words Pan Galactic Gargle Blaster

to add words to the dictionary or to turn spellchecking off for a paragraph. I like this solution and it would be a nice combination to use cargo-spellcheck as a quality gate in the pipeline and the plug-in for interactive checking.

I'd like to use both tools with the same configuration stored in one place.

Of course the feature could be implemented by an shell script which syncs both configurations, but this would neither be convenient nor robust.

drahnr commented 1 week ago

@crjeder could you list the set of directives that you use and the scope they are valid for? Otherwise this is a moving target :) I agree the above would be nice, a single source of truth for spellchecking.

crjeder commented 1 week ago

That's from the documentation of cSpell:

All settings are prefixed with cSpell: or spell-checker:

- disable -- turn off the spell checker for a section of code.
- enable -- turn the spell checker back on after it has been turned off.
- ignore -- specify a list of words to be ignored.
- words -- specify a list of words to be considered correct and will appear in the suggestions list.
- locale -- set locale (example: cSpell:locale fr,en to use French and English languages)
- ignoreRegExp -- Any text matching the regular expression will NOT be checked for spelling.
- includeRegExp -- Only text matching the collection of includeRegExp will be checked.
- enableCompoundWords / disableCompoundWords -- Allow / disallow words like: "stringlength".

To be generic I think it would be a good idea to use the spell-checker: prefix The directives I use are:

The others make sense, too. But are not as important for me.