I am trying to enable spell checking for the ‘language-latex’ package, but I can’t figure out how to do it. I tried adding the name (LaTeX), to the list of languages in the spellcheck configuration but that did not seem to be the required magic.
Also looking into this. I can get it to spell check .hbs files.
You have to add the scope name to the list of grammars that the spell check package checks:
You can find the scope name of a particular grammar by:
- Open a file that uses that grammar
- Open the Developer Tools (
View > Developer > Toggle Developer Tools)
- Switch to the Console tab
- Place the cursor anywhere in the file in question
- Open the Command Palette and execute the command
Editor: Log Cursor Scope
An array of strings will be logged, the first item in the array is the scope name for that grammar.
Is the text added into “Grammar” field appended to the default configuration or does it replace the default?
It replaces the default. All settings fields in Atom work this way, to my knowledge.
Is it possible to automatically enable spell-cheking for a custom
language-* package, so end users of the package won’t need to manually edit this setting?
Not really, no. A language package could on activation check the
spell-check.grammars configuration value and update it but:
- It is bad form to edit configuration values that aren’t yours
- I would be upset if a language package decided for me whether that language should be spell checked
Agree with both points, it can be the unexpected behaviour for most of the language packages. However, I’m interested particularly for
language-asciidoc package, I believe most of its users expect spell-checking enabled by default as well as Markdown users. Sent a PR.
Note for latex, the grammar identifier is
Can the scope be more specific than everything related to that grammar?
Ie, if I have these scopes:
Scopes at Cursor
I want to limit spell checking to comments (in
source.shell) only. I tried these options:
V source.shell X comment X source.shell.comment X source.snell.comment.line.number-sign.shell X comment.line.number-sign.shell
CTRL+SHIFT+ALT+P would log the scope of the cursor also.
On Windows or Linux, yes. On OS X it is Alt+Cmd+P.