- Как в Atom заставить разворачиваться конструкцию emmet-а «div.class» по табуляции в php файлах?
- 1 ответ 1
- Emmet doesn’t work on PHP file! #393
- Comments
- huyle2607 commented Jan 30, 2016
- sergeche commented Jan 30, 2016
- RafiKueng commented Mar 21, 2016
- sidinei-silva commented Jul 13, 2016
- scratchoo commented Aug 8, 2016
- tjhillard commented Dec 7, 2016
- renoirtech commented Jan 31, 2017
- fluxish commented Oct 19, 2017
- mikael1000 commented Jan 16, 2018
- completions not working in php file #134
- Comments
- lombardi-gux commented Aug 25, 2014 •
- Cronos87 commented Aug 28, 2014
- cloud-walker commented Sep 8, 2014
- Cronos87 commented Sep 8, 2014
- martpie commented Nov 26, 2014
- halcarleton commented Dec 9, 2014
- carloscarcamo commented Dec 10, 2014
- martpie commented Dec 10, 2014
- sergeche commented Dec 10, 2014
- sergeche commented Dec 10, 2014
- martpie commented Dec 14, 2014
- jparkerweb commented Dec 17, 2014
- silvenon commented Jan 16, 2015
- aljafor commented Apr 25, 2016
- sebszocinski commented May 11, 2016
- sebszocinski commented May 11, 2016 •
- tzs007 commented Jun 2, 2016 •
- sangeeth96 commented Jul 22, 2016
- mikedejong commented Aug 1, 2016 •
- Tab expansion is broken. #108
- Comments
- vemec commented Jul 9, 2014 •
- jpadilla commented Jul 15, 2014
- connorholyday commented Jul 25, 2014
- thinmatt commented Jul 31, 2014
- Jursdotme commented Aug 8, 2014
- PaulMorel commented Aug 15, 2014
- joepagan commented Aug 22, 2014
- jsgv commented Aug 25, 2014
- bradleyflood commented Aug 26, 2014
- sergeche commented Aug 26, 2014
- javangriff commented Sep 11, 2014
- pjv commented Sep 20, 2014
- pjv commented Oct 9, 2014
- halcarleton commented Dec 29, 2014
- silvenon commented Jan 16, 2015
- freqn commented May 30, 2015
- riebschlager commented Aug 26, 2015
- chrissm79 commented Sep 5, 2015
- jsgv commented Oct 28, 2015
- jbotos commented Dec 25, 2015
- kandros commented Jan 6, 2016
- yigitozkavci commented Jan 12, 2016
- DarrenBell commented Jan 14, 2016
- nsrau commented Jan 21, 2016
- sergeche commented Jan 21, 2016
Как в Atom заставить разворачиваться конструкцию emmet-а «div.class» по табуляции в php файлах?
Дело в том, что в html файлах отрабатывает: div.some-class преобразовывается в
1 ответ 1
В конфигурации горячих клавиш Emmet по умолчанию про Tab написано следующее:
(Этот селектор пугает ровно до того момента, пока не начнёте смотреть его по секциям, разделённым запятыми: после этого он сразу приобретает смысл)
Чтобы получить этот кусок конфигурации, откройте настройки, Keybindings, наберите в поиске expand-abbreviation и нажмите кнопку
Формат основан на CSON: как JSON, но с ароматом CoffeeScript.
В этом же окне наверху есть ссылка your keymap file. Нажав на неё, вы попадёте в файл конфигурации собственных горячих клавиш. Вставьте туда скопированный кусочек.
Как видно, он имеет формат:
Чтобы указать его действие в PHP-файлах, нужно написать соответствующий селектор. Следуя примерам из настроек по умолчанию, например, такой:
(Применимость селекторов можно проверить, открыв DevTools и найдя в DOM узел с редактором, в котором вы хотите, чтобы горячая клавиша действовала. Посмотрите на селектор, на узел, и попробуйте выполнить сопоставление в уме.)
Источник
Emmet doesn’t work on PHP file! #393
Comments
huyle2607 commented Jan 30, 2016
As in the title of the Issue, I cannot use emmet in PHP file. I don’t know why but it seems to work well on only html file.
Is there any way to make it works on file .php?
If you could do it, I would appreciate it!
The text was updated successfully, but these errors were encountered:
sergeche commented Jan 30, 2016
RafiKueng commented Mar 21, 2016
Add this to your keymap.cson file (ctrl+shift+p «open keymap»)
Would be nice to make it default thou.
sidinei-silva commented Jul 13, 2016
scratchoo commented Aug 8, 2016
@RafiKueng Awesome it works! thanks.
For those who are using laravel then add blade as well :
tjhillard commented Dec 7, 2016
Awesome — but now when I div.container it completes to
renoirtech commented Jan 31, 2017
Guys, i solved the problems related to this issues by using this extra atom package.
fluxish commented Oct 19, 2017
@medbouzid sorry, but with data-grammar=»text html php blade» now works with blade but no more with php files. why?
mikael1000 commented Jan 16, 2018
With your solution I get very strange results. For example:
On other things I don’t get anything. Just a tab.
When I google the strange string (result from .row) it turns out to be part of the integrity key from MaxCDNs bootstrap link. How did that get connected to the .row command?
However if I just remove «blade» from the code it works in blade, php, html files.
Источник
completions not working in php file #134
Comments
lombardi-gux commented Aug 25, 2014 •
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.
— 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).
The text was updated successfully, but these errors were encountered:
Cronos87 commented Aug 28, 2014
Did you tried ctrl+e?
cloud-walker commented Sep 8, 2014
ctrl-e open the Find in Current Buffer panel.
Cronos87 commented Sep 8, 2014
Search emmet:expand in Keybindings settings. From there you can see the shortcuts for the command.
martpie commented Nov 26, 2014
I have the same issue trying to add some html in a Laravel view
tab is not working but ctrl-e is.
halcarleton commented Dec 9, 2014
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 Dec 10, 2014
is there a solution for completions on php?
martpie commented Dec 10, 2014
@carloscarcamo I guess use ctrl-e, or invert ctrl-e and tab key binding maybe ? (waiting for a fix. )
sergeche commented Dec 10, 2014
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 Dec 10, 2014
If you don’t care about native snippets and still want Emmet to expand abbreviations with Tab, try the following: #108 (comment)
martpie commented Dec 14, 2014
If anyone reads this, I found another way:
In your keybindings.cson, simply add
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 Dec 17, 2014
Thanks @KeitIG, was totally what I was looking for as I use both Emmet and Autocomplete-Plus with sass and razor files.
silvenon commented Jan 16, 2015
Now you can easily enable the Tab key for other languages. More info here.
I think this can be closed then.
aljafor commented Apr 25, 2016
FYI regarding the official info, you can use
instead of targeting a specific grammar (e.g. text html php ), this targets all grammars with html detected.
sebszocinski commented May 11, 2016
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 on tab. I can’t seem to get the best of both worlds?
sebszocinski commented May 11, 2016 •
EDIT: I’ve found a fix for anyone else who’s having the same issue. the following worked for me:
tzs007 commented Jun 2, 2016 •
@Rockethouse you nailed it! that solution works proper for me. thanks!
sangeeth96 commented Jul 22, 2016
@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
For now, adding the cson code posted in #86 along with this seems to get things going smooth.
mikedejong commented Aug 1, 2016 •
Finally got the solution for this issue. With this code in the keymap.cson it will work the same way as .html files.
=»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
=»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
=»sass»]:not([mini])’:
‘tab’: ‘snippets:next-tab-stop’
Источник
Tab expansion is broken. #108
Comments
vemec commented Jul 9, 2014 •
I had a clean install of Atom, then installed emmet, and now the tab expansion is not working. When I use the keystroke shift-cmd-E it works every time.
gif example
— Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3046713-tab-expansion-is-broken?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).
The text was updated successfully, but these errors were encountered:
jpadilla commented Jul 15, 2014
👍 happening to me too
Update: I had some luck changing the tab keymap to emmet:expand-abbreviation . So it must definitely be something with the way that action is currently being handled.
connorholyday commented Jul 25, 2014
thinmatt commented Jul 31, 2014
having this issue as well 🙁
Jursdotme commented Aug 8, 2014
Same here. shift+cmd+e works but it would be nicer to use the tab key. Thats what i’m used to.
PaulMorel commented Aug 15, 2014
Having the same issue with a clean install of Atom. Even Ctrl+E doesn’t work.
joepagan commented Aug 22, 2014
jsgv commented Aug 25, 2014
Is there a way to override this temporarily? To set it to expand on tab ?
bradleyflood commented Aug 26, 2014
sergeche commented Aug 26, 2014
Proper Tab key handling is pretty tricky because this single key has many features depending on context: expand snippet, move to tabstop, indent selection etc.
To not break your editing experience, Emmet expands abbreviations by Tab only if:
- there’s no selected text;
- there’s no active tabstops (might be generated by default snippets or some other plugins)
- Emmet supports current syntax
Thus, the reason why Tab key expander might not work for you:
- Some other plugin overrides Tab key and blocks Emmet
- There are active tabstops (press Esc to reset)
- You are editing file of unknown syntax. Since Emmet can “eat” any word and transform it into something, and this behavior blocks default editor snippets (i.e. breaks your editing experience). Currently, Emmet supports only HTML, XML, XSL, CSS, SCSS/Sass, LESS and Stylus syntaxes, but you can extend it with new syntaxes. If you want Tab expander to work in another syntax, you may add something like this in your custom snippets.json file:
javangriff commented Sep 11, 2014
Just thought i would leave a comment here too, just commented on a duplicate issue, this seems to be a conflict with atoms snippets package, after disabling this package it works as expected!
pjv commented Sep 20, 2014
thanks @javogriff, that was it for me. it was driving me crazy.
pjv commented Oct 9, 2014
i don’t know if this is true for anyone else following this issue, but for me, i just discovered that the emmet package in my atom install was never updating. i was at version 0.90 while at the time of this comment the current version of the package is 2.1.3. other packages have been updating normally, but for some reason, emmet was stuck. after uninstalling and reinstalling emmet to get me to the current version, this problem went away for me.
halcarleton commented Dec 29, 2014
I tried extending «liquid» with «html» but it still doesn’t tab expand.
silvenon commented Jan 16, 2015
You can now easily enable tab for your favorite language, read this for more info. This works for me now.
freqn commented May 30, 2015
Not working for me. Fresh install on Ubuntu 14.04 LTS
riebschlager commented Aug 26, 2015
Thanks @silvenon, that resolved this issue for me.
In my case the Angular package had changed the grammar of the editor to «text html angular» in an HTML file with some Angular syntax. Adding that grammar in the keymap fixed it.
chrissm79 commented Sep 5, 2015
Life saver @silvenon, thank you for that!
jsgv commented Oct 28, 2015
Im having issues now when trying to expand snippets.
They will only expand with enter not tab anymore.
jbotos commented Dec 25, 2015
Atom > Open Your Keymap
‘atom-text-editor:not([mini])’:
‘tab’: ’emmet:expand-abbreviation-with-tab’
Worked for me after restart.
kandros commented Jan 6, 2016
@jbotos ‘s response looks good (beware the second line must be indented)
Can we close this please?
yigitozkavci commented Jan 12, 2016
Thanks @jbotos that works like a charm.
DarrenBell commented Jan 14, 2016
@jbotos Thanks this was truly frustrating and made me continue on with ST3 until I found this.
nsrau commented Jan 21, 2016
sergeche commented Jan 21, 2016
Just a FYI for all frustrated about Emmet’s Tab handler in Atom compared to Sublime Text and possible workarounds.
The main reason why ST tab handler works better that Atom’s is how editor matches current scope for given key (Tab in our case). In ST you can use very deep scope selectors (down till token right before caret) but in Atom only root scope is available. For example, it ST you can use selector like text.html.php string so Tab handler will work if caret is inside PHP string and won’t if caret is somewhere else. This is good since Emmet’s «take any string and transform it into something» behavior: we can clearly mark source code regions where user would likely have Emmet to work instead of native snippets.
In Atom such deep selectors are not available: you can only tell it to override given key entirely for current document. That’s why I can’t (easily) enable Tab handler for all HTML-compatible syntaxes (like PHP, handlebars etc.): it’s a breaking change for many users who prefer to use native Atom snippets and expand them by Tab. Emmet will completely override Tab handler for such syntaxes and you won’t be able to complete native snippets with Tab key.
If you don’t use native snippets or prefer complete suggestions with Enter key (like me), you can perfectly use @jbotos solution and use Emmet in every possible editor syntax. Otherwise, you should carefully pick scope selectors for every syntax you want Emmet to work as described here.
Источник