In latest build, html.erb files default to HTML syntax highlighting. Selecting “Open all with current extension as” rails -> HTML (rails) does not persist.
3103 html.erb unable to change default syntax highlighting
I have the same problem, I thought it was due to the syntax highlighting, but no matter what I choose, it doesn’t remember the syntax choosed for .erb files. I also have experimented the same issue with scss files.
This is very likely due to using the Material Theme. Until the other day, Material was overriding the syntax association for .html.erb
files. Trying to use Open all with current extension as…
would fail since it would pick up the extension as just .erb
, not .html.erb
.
This can be solved by opening the settings file Packages/User/HTML (Rails).sublime-settings
and adding html.erb
to the extensions
setting.
Here’s what I have in my HTML (Rails).sublime-settings
file.:
{
"extensions":
[
"rails",
"erb",
"html.erb"
]
}
and it’s still not setting the syntax correctly. Did I do this right?
Check what syntax is actually set with view.settings().get('syntax')
in the console (and report it here).
view.settings().get('syntax')
'Packages/User/HTML/HTML.sublime-syntax'
It reports the correct syntax if I manually set it to HTML(Rails) first.
I’ve also been having this problem for ages and it drives me crazy whenever I’m working on a Rails project.
view.settings().get('syntax')
reports 'Packages/HTML/HTML.sublime-syntax'
and I don’t have a Packages/User/HTML
folder.
Would love a fix for this.
Execute sublime.find_resources("HTML.sublime-settings")
and post the results.
>>> sublime.find_resources("HTML.sublime-settings")
['Packages/One Dark Material - Theme/prefs/Ext/HTML.sublime-settings']
Which is a theme I wasn’t using, but rather:
"theme": "Cobalt2.sublime-theme",
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme",
I removed the One Dark Material package and now it shows:
>>> sublime.find_resources("HTML.sublime-settings")
[]
…and voila! Now working as expected. Opening an html.erb file sets the syntax to HTML (Rails).
Thanks for the help!
This is what worked for me http://joelstransky.com/how-to-fix-a-multiple-extension-syntax-conflict-in-sublime-text-3/