emmetio / emmet-atom

Emmet support for Atom
MIT License
764 stars 179 forks source link

Expanding abbreviations in haml files inserts html, not using implicit filter #262

Open russjohnson opened 9 years ago

russjohnson commented 9 years ago

Just installed emmet into the latest Atom release and when trying to expand any abbreviation in a file named like filename.html.haml it alway inserts the html snippets instead of the haml.

If I explicitly use the filter like h4|haml it works correctly.

Filetype shown in atom is Ruby Haml. Anyway to force it to use the haml filter without having to explicitly type it out?

Using Atom on OS X 10.10.3, all atom packages up to date on clean install of Atom as of 4/27

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

richpeniche commented 9 years ago

I have the same problem. I just switched back to Sublime because of this.

davidlormor commented 9 years ago

Same issue here.

davidlormor commented 9 years ago

Ultimately this is a problem with the code that determines what syntax to load...because the name of the "grammar" is "Ruby Haml" the package tries to parse it as Ruby not Haml (due to a hardcoded reference to the first word of the grammar's name.

The quick fix is to add the following to your snippets.json (following emmet/emmet-atom convention this would default to ~/emmet/snippets.json):

{
  "ruby": {
    "filters": "haml",
    "extends": "html",
    "profile": "xml"
  }
}

Also, if you want tab completion (vs. cmd+shift+e/ctrl+e) you need to add the following to your atom keymap:

'atom-text-editor[data-grammar="text haml"]:not([mini])':
  'tab': 'emmet:expand-abbreviation-with-tab'  

Hopefully I can find a little time to work on a patch that incorporates parsing the grammar name in a smarter manner.

russjohnson commented 9 years ago

Thanks! This definitely "fixes" it for now!