emmetio / emmet-atom

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

Not working in erb files #83

Open lucas-clemente opened 10 years ago

lucas-clemente commented 10 years ago

Tab expansion doesn't work in ERB files. I had this working through #43 some time ago, but since then the code got replaced and I don't know what's going on now.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/2215723-not-working-in-erb-files?utm_campaign=plugin&utm_content=tracker%2F535900&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F535900&utm_medium=issues&utm_source=github).
brandonweiss commented 10 years ago

:+1:

pulse00 commented 10 years ago

Got the same behavior in handlebars (.hbs) files. Is there a way to activate emmet for additional file extensions other than html/css?

sergeche commented 10 years ago

You can use ⌘E to expand abbreviations anywhere: https://github.com/emmetio/emmet-atom#default-keybindings Tab key requires additional logic to not interfere with default snippets

lucas-clemente commented 10 years ago

Is there a reason why syntax detection is based on grammar, not on scope? That should allow it to work in anything that resembles HTML.

sergeche commented 10 years ago

You may want to use default snippets in HTML scope of ERB-files to create ERB-structs like <%= ... %>

lucas-clemente commented 10 years ago

Ah, I see. Do you know how this problem is solved e.g. in the sublime plugin? Do they have expansion priorities or sth?

sergeche commented 10 years ago

In ST it’s impossible to properly solve this issue (e.g. make distinction between static built-in snippets and dynamic Emmet abbreviations) due to lack of API.

But it quite possible in Atom due to its open-source nature: it’s possible to contribute some API points to default Atom’s snippets package to retrieve all matched snippets for given scope

lucas-clemente commented 10 years ago

Sounds neat. Is this something that is being worked on, or should I have a look?

sergeche commented 10 years ago

No, I’m not working on it

pulse00 commented 10 years ago

You can use ⌘E to expand abbreviations anywhere

thanks, ⌘E is working fine.

davidrunger commented 9 years ago

The shortcut seems to be shift + ⌘ + e now.

Edit: Ahh, of course. Nothing has changed. ⌘ + E == shift + ⌘ + e.

timohofmeijer commented 9 years ago

I'd really like tab expansion in handlebars files. ⌘E sucks. Doen anyone know a way how to get this to work?

silvenon commented 9 years ago

From v2.3.0 you can easily enable the Tab key for any language. Read this for more info.

brunowego commented 9 years ago

Thanks @silvenon :+1: Works!

File -> Open Your Keymap

'atom-text-editor[data-grammar="text html mustache"]:not([mini])':
    'tab': 'emmet:expand-abbreviation-with-tab'
natecox commented 9 years ago

@silvenon @brunowego Thank you, exactly what I was looking for!

adeyahya commented 9 years ago

add this to keymap.cson

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

data-grammar for erb is

text html erb
weekeight commented 9 years ago

I just can not find the keymap.cson file in st2,there is no open your keymap menu item, who can tell me?

silvenon commented 9 years ago

ST2 as in Sublime Text 2? This is an Atom plugin :grin:

Swelly commented 9 years ago

I'm a ST3 user and I'm trying to enable erb snippets within Emmet as well @weekeight. I'm not so hopeful after seeing @sergeche's post haha

weekeight commented 9 years ago

@Swelly https://github.com/weekeight/weekeight.github.io/issues/28

OneHoopyFrood commented 9 years ago

@adeyahya I show the data-grammar as text html ruby and the functionality reflects this. Can anyone else confirm?

alobintechnologies commented 8 years ago

Try with this: It's working for me.

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

alobintechnologies commented 8 years ago

my keymap.cson is:

'atom-text-editor[data-grammar="text html basic"]:not([mini]), atom-text-editor[data-grammar~="text erb basic"]:not([mini])': 'tab': 'emmet:expand-abbreviation-with-tab'

samuelpismel commented 7 years ago

This one works for me (Atom 1.14.2):

'atom-text-editor[data-grammar="text html ruby"]:not([mini])':
    'tab': 'emmet:expand-abbreviation-with-tab'
louwers commented 6 years ago

@brunowego's comment should be in the docs.