This is an Atom editor package to let the author of a source file add a comment to force the file to use a certain grammar (aka "mode" in EMACS) and show the appropriate syntax highlighting. This is needed on files with no extensions or files that start with one language but then are mostly another language (like react view files).
Enter the terminal command
apm install grammar-mode or use the
+ Install button in the settings tab (
ctrl-,) and search for grammar-mode.
Add a string with this format anywhere in the file, usually in a comment.
EXTENSION should be a typical source file extension for the type of file that uses the grammar you want your file to use. The period at the beginning is optional and nothing is case-sensitive.
-*- grammar-ext: EXTENSION -*- Examples ... # -*- grammar-ext: .coffee -*- // -*- grammar-ext: js -*-
grammar-ext comment is detected and the syntax highlighting set when the file is loaded. If you add a comment and want to see the results immediately then you need to issue a command to check all the loaded files. This is done with the
grammar-mode:check-all command which is bound by default to
Grammar-mode is copyright Mark Hahn with the MIT license.
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.