-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Expanding HTML abbreviation in double-quote PHP strings breaks the string #155
Comments
It’s possible to set output quotes of generated Emmet snippets. I made a small update in 2.3.3 so you can set it for PHP but it’s quite tricky:
"phpstr": "string.quoted.double.php" e.g. whenever you expand abbreviation inside
"config": {
"phpstr": {
"options": {
"output.attributeQuotes": "single"
}
}
} Your final {
"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",
"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",
// Your custom syntax
"phpstr": "string.quoted.double.php"
},
"config": {
"phpstr": {
"options": {
"output.attributeQuotes": "single"
}
}
}
} |
Thanks @sergeche. This is close, however there are still some issues as I can't get this fix to work while still allowing me to expand abbreviations with the tab key. It seems to be conflicting with the solution from this previous issue. It looks like it has to do with the "html" syntax scope - I currently have it set to Here's my current user settings: {
// Editor scope to Emmet syntax mapping
"syntax_scopes": {
"html": "text.html - source - meta.attribute-with-value.style, text.html source.php string",
"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",
"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",
// custom scope for double-quoted PHP strings
"phpstr": "string.quoted.double.php"
},
"abbreviation_scopes": [
"source.php string",
"(text.html | text.xml) - source - meta - comment",
"source.sass - meta.property-value - meta.property-name - string - punctuation - comment",
"(source.css | source.scss | source.less | source.postcss | source.stylus) & meta.property-list",
"(source.css | source.scss | source.less | source.postcss | source.stylus) - meta.property-value - meta.property-name - string - comment",
"(source.tsx | source.js | source.jsx) - comment",
"text.html.cfml - meta.tag",
// Inline CSS
"text.html meta.attribute-with-value.style (string.quoted | source.css)"
],
"config": {
// custom scope for double-quoted PHP strings
"phpstr": {
"options": {
"output.attributeQuotes": "single"
}
}
}
} |
Hey @sergeche, it's been a few days so just wanted to double-check you were aware of the ask. No rush. |
Not sure where the problem is and what you’re trying to achieve |
I'll try to go into more detail. I'm wondering if there is a way to both:
Referencing this previous issue; the solution for No. 2 involved adding the
It seems this doesn't play well with the solution you provided. I have tried modifying the As an example, when I force an HTML abbreviation to expand using the <?php
echo 'foo.bar';
// Expands into:
echo '<foo class="bar"></foo>';
echo "foo.bar";
// Expands into:
echo "<foo class='bar'></foo>";
?> However, when I try to expand with the <?php
echo "foo.bar";
// Expands into:
echo "foo.bbcode_set_arg_parser(bbcode_container, bbcode_arg_parser)"; // Some random intellisense garbage
?> Hope this makes it more clear. |
OK, so it looks like you’re trying to the same behaviour with Tab key as in HTML? With automatic abbreviation marking and preview? |
Yup, that's correct. |
I need some time to update plugin to make this work |
Sounds good - thanks for looking into this. |
When expanding HTML in double-quote PHP strings, any quotes inside the resulting code are also double quotes, which breaks the string. Is it possible to edit my Emmet settings to detect and take this into account?
The text was updated successfully, but these errors were encountered: