Sublime Forum

[Solved] How to stop from spellchecking my include file name?

#1

How to stop from spellchecking my include file name?

On the default Sublime Text syntax file for C++, the include file sentence is defined within the following scopes:

string.quoted.other.lt-gt.include
meta.preprocessor.include.c++

My “spelling_selector”:

"markup.raw, source string.quoted - punctuation - meta.preprocessor.c.include, source comment - source comment.block.preprocessor, -(source, constant, keyword, storage, support, variable, markup.underline.link, meta.tag)",

As I do not want to disable the spell checker on strings quoted, how may be the problem fixed?
How may I override only the default preprocessor syntax file from sublime text?
Do you think it is worth to remove the string.quoted scope form the default Sublime Text C++ syntax regex?

I do not see why is useful to set the C++ includes file names directives as string.quoted, because it is interfering within the spell checker.
It is because there is no sense to apply spell checking the the include file’s names. Or may be there is it? I do not think so. Just because of these examples: (all misspellings)

#include "myclass.h"
#include <mutex.h>
#include <utility/ostream>
#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <cstring>
#include <cstdlib>
#include <errno.h>
#include <sys/mman.h>

Moreover, more interesting than removing it from the default sublime syntax, is to exclude the string from spellchecking when the scope string.quoted is met, but within it there also another scope, and on my case this scope is meta.preprocessor.
So, there is a way to set the spelling_selector setting to accomplish it?

0 Likes

#2

Yes, there currently is. Looks like this setting to do the job:

"spelling_selector": "source string.quoted - punctuation - meta.preprocessor.include",

As it is there is no need to change the default C++ sublime syntax, as it may be handled by the user settings file as above show.

0 Likes