Remember Syntax Highlighting


#1

This is either a bug… or a feature request. Atom doesn’t have a way to remember syntax highlighting, if you are forcing a certain type of highlighting for something non-standard.

Here’s my use-case: I use Emblem.js and the Ruby Slim package for syntax highlighting. Every time I open up a *.emblem file, Atom refers to it as plain text. There is no way to tell Atom to highlight all files with this extension with the Ruby Slim package, nor does Atom remember my preference.

Slightly annoying. I’ve switched from Sublime 3 beta, which has the option and a bug where it just doesn’t remember. So I’m used to constantly changing my syntax highlighting… But a boy can dream of one day not ever having to always choose how to colorize a file whenever it’s opened!


#2

I’d love to see a way of associating file extensions with languages handled by the settings component in a standardized fashion.

Languages could furnish their own defaults, and Atom could automatically present you with a way to modify them in that language’s settings pane, automatically for all languages.


#3

I’ve found I’ve ran into the same issue with .kit files which compile to HTML every time I open one it does not know how to highlight it till I set it. Really wish I could get it to remember the settings.


#4

I, also, have the same issue. Many NodeJS templating languages have strange, non-standard extensions, and redoing the highlighting to HTML every time is pretty tedious…


#5

With a little work I managed to get Atom to remember this setting.

In settings locate “Language Php” (or whatever language you need to add extensions to) and select Open in Atom.

Now open grammars > php.json and add your extensions to the list of File Types.

Proffit?!?


#6

I’ve tried to do that, and if you already have that kind of extension in other language it will open that file with the default language, in my case I use handlebars language with the HTML extension and I’ve have change the grammar file of handlebars to admit HTML extension but because I have the Language HTML package with the same extension Atom always open my HTML files with HTML syntax.


#7

#8

I have the same issue with ERB files in Ruby on Rails projects. I prefer the HTML (Rails) grammar, but Atom always opens files with the HTML (Ruby - ERB) grammar. My guess is because language-ruby matches the file extension before language-ruby-on-rails does and it stops there.

It would be nice if you could either prioritize the matching order for languages or make it easy to disable grammars for specific languages.


#9

similar issue but requiring different solution, I’m editing a c++ project that uses .h files as c++ headers, every time i open them i have to change from C to C++.
having a global setting to make .h files as C++ is not correct either, i would like to have a folder or project based settings remembering each individual file type because they can be mixed, instead of rules.
please support projects on the core, I understand that recalling individual file type on a global scale is not practical.