emmetio / emmet-atom

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

Emmet breaks custom html snippet expansion #146

Open serkandurusoy opened 10 years ago

serkandurusoy commented 10 years ago

As may be followed at https://github.com/ThusStyles/meteor-snippets/issues/4#issuecomment-57050554 emmet's snippet expansion with tab on html files breaks other custom snippets' tab expansion.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4903772-emmet-breaks-custom-html-snippet-expansion?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).
manolenso commented 10 years ago

you can disable key tab in Emmet by comment line in keymap.cson disableemmet

serkandurusoy commented 10 years ago

Hi, thank you for your suggestion, unfortunately, that is not a great option for those like me who have grown very accustomed to using the tab key.

It would be great if emmet distinguished between what's typed under the cursor and pass along the tab key to atom so that other snippet completions work.

For example when I type mtp there is no expansion available to that in emmet, so it automatically expand it to <mtp></mtp> however, it should do nothing and let other snippets work, in my case meteor snippets.

Furthermore, this is only a problem with html files, not javascript files, so there obviously is something out of the ordinary going on there.

manolenso commented 10 years ago

Hello, i use snippets in js and coffeescript without any problems or unwanted expansions,but with the html there unexpected behavior with a several letters in Atom.

For example when i type a+tab, that extends <a href="#"></a> what is normal ! but when you type inside a snippets aera, and tab key to jump to the next section that extends aer<a href="#"></a> This behavior makes the edition in snippets unavailable!.

I made a package for Zurb Foundation, and unfortunately I must restrict the use of the tab key for the edition. I think it is a basic behavior in Atom I will make research on this subject. otherwise i will post in Atom. By.

serkandurusoy commented 10 years ago

Great, thank you for looking into this.

felgeekpe commented 9 years ago

Open your Keymap and add

'.pane .editor:not(.mini)':
  'tab': 'snippets:expand'

This will override emmet's expansion with tab so if you want to use emmet you'll need to expand with ctrl+e

ex-jedi commented 9 years ago

Yep, having the same issue here. I'd like to find a way to disable expanding unknown tags. This is the one niggle I have that's keeping me from jumping off Sublime, which seems to handle this pretty well.

kumarasinghe commented 9 years ago

Alternatively...

You can make autocomplete-plus show snippets by installing autocomplete-snippets package. In this way,

Wow! I Love markdown! Cheers!!
manolenso commented 9 years ago

Thank's for sharing!

MethodGrab commented 9 years ago

If anyone is still having problems expanding HTML attribute snippets with emmet-atom + autocomplete-plus (Atom 0.199.0), my work around is to overwrite enter in my keymap.cson:

'atom-text-editor:not(mini).autocomplete-active':
    'enter': 'autocomplete-plus:confirm'

This makes it possible to use emmet expansions with tab and built-in expansions with enter.

filipeaguiar commented 9 years ago

It's still happening in 0.207.0. I've created 2 snippets to add the wiredep tags: wirecss and wirejs. When I write wirecss I can see that the snippet is recognized by Atom, as it show the green arrow in the dropdown. But when I press tab I get <wirecss></wirecss> instead. That's very annoying, to be honest.

bjmiller commented 9 years ago

The way to "fix" this is to edit the expand-abbreviation-with-tab command to check whether the current symbol left of the cursor is a valid emmet abbreviation, and call abortKeyBinding() if it isn't. For reference: https://atom.io/docs/v1.0.0/behind-atom-keymaps-in-depth

ethanclevenger91 commented 8 years ago

autocomplete-snippets works great for starting a snippet, but if you have multiple tab stops, advancing will trigger Emmet again

ethanclevenger91 commented 8 years ago

Here's a solution by adding some rules in your own keymap. You may need to either add the text html php grammar to the final keymap if you haven't set up php to extend html context in Emmet

sheriffderek commented 8 years ago

Are there any updates on this? The goal is this:

...right? Sublime acts this way. Maybe some smarty-pants can look at their implementation?

petrchutny commented 7 years ago

I would also appreciate Emmet developers to enable an option in the setting, which would stop epanding non-existing words into pair tags and let the snippets expand by tab instead.

sergeche commented 7 years ago

You should try new Emmet 2 alpha instead: https://github.com/emmetio/atom-plugin