Switch to settings.html.completion.attributeDefaultValue

This commit is contained in:
Stephen Sigwart 2021-08-18 21:20:50 -04:00
parent 40b976f056
commit c5d3ad08f0
3 changed files with 25 additions and 10 deletions

View File

@ -38,6 +38,22 @@
"type": "object", "type": "object",
"title": "HTML", "title": "HTML",
"properties": { "properties": {
"html.completion.attributeDefaultValue": {
"type": "string",
"scope": "resource",
"enum": [
"doubleQuotes",
"singleQuotes",
"empty"
],
"enumDescriptions": [
"%html.completion.attributeDefaultValue.doubleQuotes%",
"%html.completion.attributeDefaultValue.singleQuotes%",
"%html.completion.attributeDefaultValue.empty%"
],
"default": "doubleQuotes",
"description": "%html.completion.attributeDefaultValue%"
},
"html.customData": { "html.customData": {
"type": "array", "type": "array",
"markdownDescription": "%html.customData.desc%", "markdownDescription": "%html.customData.desc%",
@ -188,12 +204,6 @@
"default": true, "default": true,
"description": "%html.autoClosingTags%" "description": "%html.autoClosingTags%"
}, },
"html.doNotAddAttributeQuotes": {
"type": "boolean",
"scope": "resource",
"default": false,
"description": "%html.doNotAddAttributeQuotes%"
},
"html.hover.documentation": { "html.hover.documentation": {
"type": "boolean", "type": "boolean",
"scope": "resource", "scope": "resource",

View File

@ -28,7 +28,10 @@
"html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.", "html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.",
"html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.", "html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.",
"html.autoClosingTags": "Enable/disable autoclosing of HTML tags.", "html.autoClosingTags": "Enable/disable autoclosing of HTML tags.",
"html.doNotAddAttributeQuotes": "Controls whether quotes are automatically added when completing an attribute.", "html.completion.attributeDefaultValue": "Controls the default value for attributes when completion is accepted.",
"html.completion.attributeDefaultValue.doubleQuotes": "Attribute value is set to \"\".",
"html.completion.attributeDefaultValue.singleQuotes": "Attribute value is set to ''.",
"html.completion.attributeDefaultValue.empty": "Attribute value is not set.",
"html.mirrorCursorOnMatchingTag": "Enable/disable mirroring cursor on matching HTML tag.", "html.mirrorCursorOnMatchingTag": "Enable/disable mirroring cursor on matching HTML tag.",
"html.mirrorCursorOnMatchingTagDeprecationMessage": "Deprecated in favor of `editor.linkedEditing`", "html.mirrorCursorOnMatchingTagDeprecationMessage": "Deprecated in favor of `editor.linkedEditing`",
"html.hover.documentation": "Show tag and attribute documentation in hover.", "html.hover.documentation": "Show tag and attribute documentation in hover.",

View File

@ -26,9 +26,11 @@ export function getHTMLMode(htmlLanguageService: HTMLLanguageService, workspace:
if (doAutoComplete) { if (doAutoComplete) {
options.hideAutoCompleteProposals = true; options.hideAutoCompleteProposals = true;
} }
let doNotAddAttributeQuotes = settings && settings.html && settings.html.doNotAddAttributeQuotes; let attributeDefaultValue = settings && settings.html && settings.html.completion.attributeDefaultValue;
if (doNotAddAttributeQuotes) { if (attributeDefaultValue === 'empty') {
options.doNotAddAttributeQuotes = true; options.useEmptyAttrValue = true;
} else if (attributeDefaultValue === 'singleQuotes') {
options.useSingleQuotesForAttrs = true;
} }
const htmlDocument = htmlDocuments.get(document); const htmlDocument = htmlDocuments.get(document);