vscode-spellright icon indicating copy to clipboard operation
vscode-spellright copied to clipboard

Do not check words preceeded with % (percent)

Open Ben-Voris opened this issue 3 years ago • 1 comments

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?

Ben-Voris avatar Jan 26 '22 02:01 Ben-Voris

This should do what you want.

"spellright.ignoreRegExpsByClass": {
      "c": [
          "/%(hd|ld|Ld)/g",
      ],
      "cpp": [
          "/%(hd|ld|Ld)/g",
      ],
}

image

martincook3 avatar Apr 11 '22 10:04 martincook3