emmetio / emmet-atom

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

completions not working in php file #134

Open lombardi-gux opened 10 years ago

lombardi-gux commented 10 years ago

This might be due to this being a Wordpress template, where it by definition is a partial "html" file, but as you can see, trying to add a div with div.foo[tab] or .foo[tab] does nothing.

It works fine in a plain vanilla HTML file.

php2

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4033715-completions-not-working-in-php-file?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).
Cronos87 commented 10 years ago

Did you tried ctrl+e?

cloud-walker commented 10 years ago

ctrl-e open the Find in Current Buffer panel...

Cronos87 commented 10 years ago

Search emmet:expand in Keybindings settings. From there you can see the shortcuts for the command.

martpie commented 9 years ago

I have the same issue trying to add some html in a Laravel view

tab is not working but ctrl-e is.

halcarleton commented 9 years ago

I'm having the same issue in a .liquid file on windows 8. ctrl+e works but tab doesn't. In the key bindings for emmet emmet:expand-abbreviation is set to ctrl+e and emmet:expand-abbreviation-with-tab is set to tab

In an .html file tab works for expanding abbreviations.

carloscarcamo commented 9 years ago

is there a solution for completions on php?

martpie commented 9 years ago

@carloscarcamo I guess use ctrl-e, or invert ctrl-e and tab key binding maybe ? (waiting for a fix...)

sergeche commented 9 years ago

This issue won’t be fixed because it interferes with default snippets. Tab expander intentionally works in HTML and CSS only, because only in this syntaxes Emmet can fully replace native editor snippets.

sergeche commented 9 years ago

If you don’t care about native snippets and still want Emmet to expand abbreviations with Tab, try the following: https://github.com/emmetio/emmet-atom/issues/108#issuecomment-53386679

martpie commented 9 years ago

If anyone reads this, I found another way:

In your keybindings.cson, simply add

'.pane .editor:not(.mini)':
  'tab': 'emmet:expand-abbreviation'

This will make Emmet works in .php files (overriding emmet:expand-abbreviation-with-tab action)

Care this might cause conflicts with other plugins as autocomplete or autocomplete-plus.

edit: here is a keymap.cson resolving conflicts with emmet-atom and autocomplete-plus: https://gist.github.com/KeitIG/532134a7390eea142792

jparkerweb commented 9 years ago

Thanks @KeitIG, was totally what I was looking for as I use both Emmet and Autocomplete-Plus with sass and razor files.

silvenon commented 9 years ago

Now you can easily enable the Tab key for other languages. More info here.

I think this can be closed then.

alainux commented 8 years ago

FYI regarding the official info, you can use


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

instead of targeting a specific grammar (e.g. text html php), this targets all grammars with html detected.

sebszocinski commented 8 years ago

This doesn't fix php tags.

I want to be able to use emmet's div.className tab completion as well as being able to type php and it auto completes to <?php ?> on tab... I can't seem to get the best of both worlds?

sebszocinski commented 8 years ago

EDIT: I've found a fix for anyone else who's having the same issue... the following worked for me:

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

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

'.pane .editor:not(.mini)':
    'tab': 'snippets:expand' 
tzs007 commented 8 years ago

@rockethouse you nailed it! that solution works proper for me. thanks!

runofthemillgeek commented 8 years ago

@rockethouse This worked for me for quite a while until I bumped into another problem. Say I type input and expand it. The type attribute is highlighted and if I change it to something like text and hit tab to get to the next tab stop, instead of doing that, it expands text to <text></text> which sucks.

For now, adding the cson code posted in #86 along with this seems to get things going smooth.

mikedejong commented 8 years ago

Finally got the solution for this issue. With this code in the keymap.cson it will work the same way as .html files.

'atom-pane atom-text-editor[data-grammar~="html"]:not([mini]):not(.autocomplete-active), atom-pane atom-text-editor[data-grammar~="html"]:not([mini]):not(.autocomplete-active), atom-pane atom-text-editor[data-grammar~="php"]:not([mini]):not(.autocomplete-active), atom-pane atom-text-editor[data-grammar~="php"]:not([mini]):not(.autocomplete-active), atom-pane atom-text-editor[data-grammar~="xml"]:not([mini]):not(.autocomplete-active)': 'enter': 'emmet:insert-formatted-line-break-only'

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

'atom-text-editor.autocomplete-active:not([mini])': 'tab': 'autocomplete-plus:confirm'

'atom-text-editor[data-grammar="text html basic"]:not([mini]), atom-text-editor[data-grammar="text html php"]:not([mini]), atom-text-editor[data-grammar~="jade"]:not([mini]), atom-text-editor[data-grammar="text html php"]:not([mini]), atom-text-editor[data-grammar~="css"]:not([mini]), atom-text-editor[data-grammar~="sass"]:not([mini])': 'tab': 'snippets:next-tab-stop'

sparcut commented 8 years ago

@KeitIG Thanks so much!

ghost commented 8 years ago

@MikedeJong Thank you heaps!! Your fix works great.

yekurtal commented 7 years ago

For macOS Sierra user's ONLY:

I used alt-tab because it makes sense to me, you can choose your own(Be aware that is isn't in use).

Atom(upper right next to apple logo) -> Keymap... -> paste it like this:

'.platform-darwin atom-text-editor:not([mini])':
  'alt-tab': 'emmet:expand-abbreviation'

NOT LIKE THIS:

# '.platform-darwin atom-text-editor:not([mini])':
#   'alt-tab': 'emmet:expand-abbreviation'

Let me know if it doesn't work.

aManNamedJed commented 7 years ago

It happens to be Cmd + Shift + E on Mac :(

Seul-L commented 7 years ago

Is there a way to change Cmd + Shift + E on Mac to just Tab or no?