-
Notifications
You must be signed in to change notification settings - Fork 33
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
Adding vendor prefixes to css abbreviations #13
Conversation
// Fix for https://github.com/Microsoft/vscode/issues/28933#issuecomment-309236902 | ||
// When user types in propertyname, emmet uses it to match with snippet names, resulting in width -> widows or font-family -> font: family | ||
// Filter out those cases here. | ||
const abbrRegex = new RegExp('.*' + abbreviation.split('').map(x => x === '$' ? '\\$' : x).join('.*') + '.*', 'i'); | ||
let abbreviationWithoutDashPrefix = abbreviation[0] == '-' ? abbreviation.slice(1) : abbreviation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only applicable for css abbreviations. So I'd suggest to have a another function vendorPrefixCssAbbreviation
that takes in abbreviation and syntax and returns a boolean. You can use isStylesheet
to check the syntax as well as look for the preceeding -
.
Re-use this function inside expandAbbreviationWithDash
- rename this function as
expandCssAbreviationWithVendorPrefixes
- have a check on the syntax. Use the
isStylesheet
function.
Also rename expandAbbreviationWithDash
to expandCssAbbreviationWithVendorPrefix
src/emmetHelper.ts
Outdated
@@ -525,10 +525,10 @@ export function getExpandOptions(syntax: string, emmetConfig?: object, filter?: | |||
}; | |||
} | |||
|
|||
export function expandAbbreviationWithDash(abbreviation: string, options: any) { | |||
export function expandCSSAbbreviationWithVendorPrefixes(abbreviation: string, options: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- no need to export this function
- rename (again, sorry!) to just
expandCSSAbbreviation
Modified so that when preceding a CSS abbreviation with a dash, it gets expanded with all the vendor-prefixes.
For example,
-bdrd10
gets expanded to