benjohnson / atom-django-templates

Atom support for Django templates.
23 stars 10 forks source link

conflict with emmet? #3

Closed whaleforever closed 9 years ago

whaleforever commented 9 years ago

Hi,

Thank you for this wonderful plugin for atom. Recently, I stumble with this issue, when I tried to type html>body (emmet shortcut) the result would be

html><body>
</body>

it should have :

<html>
<body></body>
</html>

when I disable thus plugin it work normally, I want that this plugin and emmet can work side by side, is there a way to solve this conflict ? thanx

phette23 commented 9 years ago

Emmet is actually disabled entirely in the Django template syntax; the result you see is Atom saying "OK, I need to expand this <body> tag when you hit tab and just leave the text before it (html>) alone".

As the Emmet-Atom readme explains, you can add support for any additional grammar by editing your keymap file. Here's the specific keymap.cson hash needed to make Django templates work with Emmet:

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

That's because the "text html django" grammar isn't supported initially. So if anything this bug is with Emmet, not this project, and can be closed.

johnfraney commented 9 years ago

@phette23 I was just scratching my head trying to figure out why tab completion using HTML (Django) was different from regular HTML, and you saved my fingers a lot of work!

I think it might be a good idea to add that Emmet code snippet to the README. I'll send a PR.

Edit: Added instructions to the Readme in PR #15. I also created a PR with emmet-atom to add the "text html django" grammar to its list.

benjohnson commented 9 years ago

Thanks @johnfraney. Closing after merging #15.