emmetio / emmet-atom

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

Disable emmet tab completion in PHP tags #293

Open sebj54 opened 9 years ago

sebj54 commented 9 years ago

I am trying to disable Emmet inside PHP tags. I found how to activate tab completion in PHP files but it is not really useful because Emmet autocompletion is triggered when I am pressing the tab key instead of PHP completion.

For example, if I am pressing tab after if, it will give me <if></if> which has no sense inside <?php ?> tags.

So I tried to enable completion in PHP files outside the tags with the folowing config:

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

But it has no effect. Is it any way to do this? Thanks in advance.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/23463607-disable-emmet-tab-completion-in-php-tags?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).
sergeche commented 9 years ago

You are trying to add new expand abbreviation keybinding instead of removing it. See https://atom.io/docs/v1.0.0/behind-atom-keymaps-in-depth#removing-bindings

sebj54 commented 9 years ago

Thanks for the link, but that's not exactly what I need here. I don't want to unset the tab binding, because, if I do, I won't have any completion: neither PHP or Emmet.

By default, Emmet tab completion is not activated on PHP files. According to the documentation, I have to put these lines in my keymap file:

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

I did and it works. The problem is that it overrides PHP completion and I get html tags in my php code, which has no sense.

What I would like is the ability to allow Emmet tab completion for PHP files only outside PHP tags.

rquispeq commented 7 years ago

Hey! could you fixed it? I have that problem too :/

atcheri commented 7 years ago

it just worked for me in the file keymap.cson, changing from: 'atom-text-editor:not([mini])': 'tab': 'emmet:expand-abbreviation-with-tab'

to

'atom-text-editor:not([mini, php])': 'tab': 'emmet:expand-abbreviation-with-tab'

Note: you can still use the ctrl-e shortcut (on linux) to force emmet expanding an html component in a php file though.

classikd commented 6 years ago

@atcheri Thanks a lot it helped me !!