How to enable spell checking for another language


#1

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.


#2

Also looking into this. I can get it to spell check .hbs files.


#3

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:

  1. Open a file that uses that grammar
  2. Open the Developer Tools (View > Developer > Toggle Developer Tools)
  3. Switch to the Console tab
  4. Place the cursor anywhere in the file in question
  5. 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.


#4

Thanks @leedohm, that did the trick :smiley:


#5

Is the text added into “Grammar” field appended to the default configuration or does it replace the default?


#6

It replaces the default. All settings fields in Atom work this way, to my knowledge.


#7

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?


#8

Not really, no. A language package could on activation check the spell-check.grammars configuration value and update it but:

  1. It is bad form to edit configuration values that aren’t yours
  2. I would be upset if a language package decided for me whether that language should be spell checked

#9

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.


#10

Note for latex, the grammar identifier is text.tex.latex.


#11

Can the scope be more specific than everything related to that grammar?

Ie, if I have these scopes:

Scopes at Cursor

source.shell
comment.line.number-sign.shell

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

#12

CTRL+SHIFT+ALT+P would log the scope of the cursor also.


#13

On Windows or Linux, yes. On OS X it is Alt+Cmd+P.