Multiple scopes within a custom language package for spell-check purposes?


I am using a custom language package called “language-renpy” that has a scope “source.renpy” that I’d like to switch the spell checker on for.

Which is easy enough. Just add “source.renpy” to the list of grammars checked by spell-check.

Except, because there is only a single scope, it spell checks everything with the source file. Variable names, scene descriptors and a whole load of other stuff that are rarely going to be actual English words.
I could of course add each of these “bad” words to my custom dictionary (I assume) and work around it that way.

But something else occurred to me, while I was trying to figure out if having the spell check switched on was worth all the hassle.

Is it possible to subdivide the custom language file into multiple scopes?

What I’m thinking is that if language file could scope text within quotes or in comment lines or other sections (which I assume it must do already, in order to color different areas of the source code as it does) - then the spell checker could be selective about which areas of the source code are spell checked.

Double extra bonus points if those scopes could be “text.plain” - which is already listed within the spell-check configuration. Which avoid the need to add custom scopes to the settings to get the spell checker to work.

I did try to see if any of the default language packages already included more than one scope… but I’m very new to Atom and couldn’t actually find anything except the extra packages I’d installed myself.

Obviously I may be completely missing the point of scopes here. This is very much a “wishful thinking” question.


I haven’t tried this, so I don’t know if it will work, but you can tell Atom to open another grammar and match against that for everything inside the current match (for when you match a block of quotes, or comments, or embedded code, or PHP) by placing a patterns key inside your entry and giving it include: 'text.plain'. Here’s an example.