vscode-spellright
vscode-spellright copied to clipboard
Do not check words preceeded with % (percent)
I like to spell check strings, but this means that C code like this produces multiple spelling errors:
printf ("%hd %ld %Ld\n", shortInt, longInt, longlongInt);
I could add hd, ld, and Ld as words, but they should be flagged as spelling errors unless prefixed with the % (and they probably should only be ignored in C and C++ files.
I tried adding "spellright.ignoreRegExps": ["%hd", "%ld"]
but the extension complains that both are malformed. (Fwiw https://regex101.com/ thinks these are valid JavaScript regexs.). I also tried "spellright.ignoreRegExps": ["/%hd/g", "/%ld/g"]
. This gave no error, but it had no effect.
In a relatively tiny C program, I see > 100 spelling errors for these format strings.
Can you help?
This should do what you want.
"spellright.ignoreRegExpsByClass": {
"c": [
"/%(hd|ld|Ld)/g",
],
"cpp": [
"/%(hd|ld|Ld)/g",
],
}