emmetio / emmet-atom

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

Extending Emmet via third-party Atom packages #206

Open patrick-steele-idem opened 9 years ago

patrick-steele-idem commented 9 years ago

Marko is an HTML-based templating language that extends the HTML grammar and we have an Atom package to support the Marko templating language: https://atom.io/packages/language-marko

I would like to be able to provide automatic support for Emmet when using Marko (Marko just extends HTML), but currently that does not seem to be possible. Specifically, I would like to be able to enable the following:

To overcome this problems I had to manually update my local ~/emmet/snippets.json file to include additional Marko snippets. In addition, I had to manually update my keymap.cson to include the following:

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

Having to ask every developer to do these steps is problematic and unreliable. Is there a better solution?

Thanks in advance.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/8426557-extending-emmet-via-third-party-atom-packages?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).
Solido commented 9 years ago

Marko is now my de-facto JS template and I'll be glad to have emmet support it. +1 on this request !

philidem commented 9 years ago

:+1:

sergeche commented 9 years ago

I like the idea. You can extend Emmet in run-time, see https://github.com/emmetio/emmet/blob/master/lib/emmet.js#L171 The only thing you have to do is to expose emmet object in package: https://github.com/emmetio/emmet-atom/blob/master/lib/emmet.coffee#L124

About keyboard shortcuts: you can add 'tab': 'emmet:expand-abbreviation-with-tab' shortcut into your packages’ keymap file. But I don’t know how Atom will behave if there’s no Emmet plugin installed

patrick-steele-idem commented 9 years ago

Thanks, @sergeche, for the pointers. So it looks like a good solution would be to update emmet-atom to export a reference to the internal emmet module. I could then update the language-marko package to get a reference to the instance of the emmet-atom package to register the additional Emmet snippets.

As for keyboard shortcuts, I will try out adding 'tab': 'emmet:expand-abbreviation-with-tab' and see how that goes.

Sound like a good plan? If so, I'll plan on sending a PR to export the emmet module.

Thanks again for your help.