Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use spell-check in code comments

Tags:

atom-editor

I'm really loving Github's Atom editor! However, there is one thing on which I get stuck.

I am sometimes struggeling to get code-comments without spelling mistakes. Therefore I like my editor to run a spell-check on the comments (e.g. such as Geany does). However I haven't got this working in Atom.

Let's use Python code as example. I've tried to enable the spell-check by adding:

text.python, text.py

to the "Grammars" field of the spell-check package. However no spell-check appears to be running for Python code. Also google was not helpfull...

like image 386
Tom de Geus Avatar asked Jan 01 '15 15:01

Tom de Geus


People also ask

How do you use spell check in HTML?

The spellcheck attribute specifies whether the element is to have its spelling and grammar checked or not. The following can be spellchecked: Text values in input elements (not password) Text in <textarea> elements.


2 Answers

For example, to enable spell check in PHP files, go to installed packages and search "PHP". You'll see language-php core package, open it and look for the line "Scope: text.html.php." That's what you need to insert in spell-check settings. Do the same for any other type of file where you need spelling to be checked.

It's frustrating that such simple option need so many clicks to be turned on. It really should be just as simple as it is in Sublime Text.

EDIT:

Deleted the broken link, even though it didn't hurt the answer.

Spell check in Atom must be enabled by adding scopes per language. Navigate to spell-check settings and add scopes in the grammars field, like this:

source.asciidoc, source.gfm, text.git-commit, text.plain, text.plain.null-grammar, text.html.basic, source.css.scss, text.html.php, source.css, source.js, source.json
like image 64
Nikita Avatar answered Sep 28 '22 08:09

Nikita


Scope name is the solution. add source.python for python. For any other languages do this,

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.

like image 22
Harishs Avatar answered Sep 28 '22 06:09

Harishs