Support partial emmet preferences #32496

This commit is contained in:
Ramya Achutha Rao 2017-08-29 17:26:31 -07:00
parent a8951772be
commit 4d7a7a15ca
5 changed files with 63 additions and 7 deletions

View file

@ -38,9 +38,9 @@
"resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz"
},
"vscode-emmet-helper": {
"version": "1.0.22",
"from": "vscode-emmet-helper@>=1.0.22 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-emmet-helper/-/vscode-emmet-helper-1.0.22.tgz"
"version": "1.1.0",
"from": "vscode-emmet-helper@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-emmet-helper/-/vscode-emmet-helper-1.1.0.tgz"
},
"vscode-languageserver-types": {
"version": "3.3.0",

View file

@ -79,6 +79,53 @@
"type": "boolean",
"default": false,
"description": "%emmetTriggerExpansionOnTab%"
},
"emmet.preferences":{
"type": "object",
"default": {},
"description": "%emmetPreferences%",
"properties": {
"css.intUnit": {
"type": "string",
"default": "px",
"description": "%emmetPreferencesIntUnit%"
},
"css.floatUnit": {
"type": "string",
"default": "em",
"description": "%emmetPreferencesFloatUnit%"
},
"css.propertyEnd": {
"type": "string",
"default": ";",
"description": "%emmetPreferencesCssAfter%"
},
"sass.propertyEnd": {
"type": "string",
"default": "",
"description": "%emmetPreferencesSassAfter%"
},
"stylus.propertyEnd": {
"type": "string",
"default": "",
"description": "%emmetPreferencesStylusAfter%"
},
"css.valueSeparator": {
"type": "string",
"default": ": ",
"description": "%emmetPreferencesCssBetween%"
},
"sass.valueSeparator": {
"type": "string",
"default": ": ",
"description": "%emmetPreferencesSassBetween%"
},
"stylus.valueSeparator": {
"type": "string",
"default": " ",
"description": "%emmetPreferencesStylusBetween%"
}
}
}
}
},
@ -212,7 +259,7 @@
"@emmetio/html-matcher": "^0.3.1",
"@emmetio/css-parser": "ramya-rao-a/css-parser#vscode",
"@emmetio/math-expression": "^0.1.1",
"vscode-emmet-helper": "^1.0.22",
"vscode-emmet-helper": "^1.1.0",
"vscode-languageserver-types": "^3.0.3",
"image-size": "^0.5.2",
"vscode-nls": "2.0.2"

View file

@ -29,5 +29,14 @@
"emmetShowAbbreviationSuggestions": "Shows possible emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to \"never\".",
"emmetIncludeLanguages": "Enable emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and emmet supported language.\n Eg: {\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}",
"emmetVariables": "Variables to be used in emmet snippets",
"emmetTriggerExpansionOnTab": "When enabled, emmet abbreviations are expanded when pressing TAB."
"emmetTriggerExpansionOnTab": "When enabled, emmet abbreviations are expanded when pressing TAB.",
"emmetPreferences": "Preferences used to modify behavior of some actions and resolvers of Emmet.",
"emmetPreferencesIntUnit": "Default unit for integer values",
"emmetPreferencesFloatUnit": "Default unit for float values",
"emmetPreferencesCssAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations",
"emmetPreferencesSassAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Sass files",
"emmetPreferencesStylusAfter": "Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Stylus files",
"emmetPreferencesCssBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations",
"emmetPreferencesSassBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files",
"emmetPreferencesStylusBetween": "Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files"
}

View file

@ -272,7 +272,7 @@ function expandAbbreviationInRange(editor: vscode.TextEditor, expandAbbrList: Ex
*/
function expandAbbr(input: ExpandAbbreviationInput): string {
const emmetConfig = vscode.workspace.getConfiguration('emmet');
const expandOptions = getExpandOptions(input.syntax, emmetConfig['syntaxProfiles'], emmetConfig['variables'], input.filters);
const expandOptions = getExpandOptions(input.syntax, emmetConfig, input.filters);
if (input.textToWrap) {

View file

@ -259,7 +259,7 @@ export function sameNodes(node1: Node, node2: Node): boolean {
export function getEmmetConfiguration() {
const emmetConfig = vscode.workspace.getConfiguration('emmet');
return {
useNewEmmet: true,
preferences: emmetConfig['preferences'],
showExpandedAbbreviation: emmetConfig['showExpandedAbbreviation'],
showAbbreviationSuggestions: emmetConfig['showAbbreviationSuggestions'],
syntaxProfiles: emmetConfig['syntaxProfiles'],