Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot expand HTML abbreviation in PHP tags #85

Closed
brodenbrett opened this issue Aug 26, 2020 · 10 comments
Closed

Cannot expand HTML abbreviation in PHP tags #85

brodenbrett opened this issue Aug 26, 2020 · 10 comments

Comments

@brodenbrett
Copy link

Hello,

Before the update I could expand HTML tag abbreviations within PHP strings, and now I am unable to do so. Has this been discontinued, and if so is it possible to downgrade to v1?

@soysoluble
Copy link

Hi! I have the same issue.

I try change syntax_scopes on Emmet.sublime.settings but not works :(

 "syntax_scopes": {
	"html": "text.html - source - meta.attribute-with-value.style",
	"xml": "text.xml - text.xml.xsl",
	"xsl": "text.xml.xsl",
	"jsx": "source.js.jsx | source.tsx | source.js | source.jsx",
	"haml": "source.haml",
	"jade": "text.jade | source.pyjade",
	"pug": "text.pug | source.pypug",
	"slim": "text.slim",
	"php": "embedding.php text.html.basic",

	"css": "source.css | source.postcss | meta.attribute-with-value.style.html string.quoted",
	"sass": "source.sass",
	"scss": "source.scss",
	"less": "source.less",
	"stylus": "source.stylus",
	"sss": "source.sss"
}

@sergeche
Copy link
Member

You should change abbreviation_scopes property: it detects where abbreviation can be activated

@soysoluble
Copy link

You should change abbreviation_scopes property: it detects where abbreviation can be activated

Thank you. This is the solution: #50 (comment)

@soysoluble
Copy link

Hello,

Before the update I could expand HTML tag abbreviations within PHP strings, and now I am unable to do so. Has this been discontinued, and if so is it possible to downgrade to v1?

Hi! I resolve this copy / paste on key bindings user this code: #50 (comment)

@brodenbrett
Copy link
Author

@soysoluble Hi, I tried putting this in my user key bindings, but it didn't seem to work for me. Trying to expand an abbreviation inside PHP strings still isn't working. For example:

<?php 
'div.foo';  // My string

'<div class="foo"></div>'; // What it should expand into

'div.foo	' // What it is doing instead
?>

@sergeche Could you elaborate on how I can alter the abbreviation_scopes to achieve this?

@soysoluble
Copy link

@brodenbrett you're right. Try this:

echo '
div.foo
';

@sergeche
Copy link
Member

sergeche commented Aug 26, 2020

Here’s a recipe for adding abbreviation capturing with interactive previews for PHP strings. You should open Preferences > Package Settings > Emmet > Settings:

  1. Tell Emmet that PHP string literals are context for HTML syntax. In syntax_scopes, modify html selector as follows:
"html": "text.html - source - meta.attribute-with-value.style, text.html source.php string",
  1. Then tell Emmet that abbreviation should be captured as you type in PHP strings. Add the following selector into abbreviation_scopes property: source.php string

Save the file: now typing words in string literal will follow the same logic as in HTML.

I’ve also pushed v2.1.13, it improves logic of abbreviation extraction inside string literals so you’ll be able to expand it right before quote, e.g. 'div.foo|'.

@sergeche
Copy link
Member

sergeche commented Aug 26, 2020

Also note that in suggested solution to mimic old Emmet behaviour with Tab key, you can limit selector argument to source.php string so it will work inside PHP string literals only

@soysoluble
Copy link

@sergeche thanks. Sorry for the question but not find documentation for add css auto prefix on this version :)

@brodenbrett
Copy link
Author

@sergeche Thank you! This solved my issue. Appreciate the quick response and update as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants