Skip to content

Commit c5d3ad0

Browse files
committed
Switch to settings.html.completion.attributeDefaultValue
1 parent 40b976f commit c5d3ad0

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

extensions/html-language-features/package.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@
3838
"type": "object",
3939
"title": "HTML",
4040
"properties": {
41+
"html.completion.attributeDefaultValue": {
42+
"type": "string",
43+
"scope": "resource",
44+
"enum": [
45+
"doubleQuotes",
46+
"singleQuotes",
47+
"empty"
48+
],
49+
"enumDescriptions": [
50+
"%html.completion.attributeDefaultValue.doubleQuotes%",
51+
"%html.completion.attributeDefaultValue.singleQuotes%",
52+
"%html.completion.attributeDefaultValue.empty%"
53+
],
54+
"default": "doubleQuotes",
55+
"description": "%html.completion.attributeDefaultValue%"
56+
},
4157
"html.customData": {
4258
"type": "array",
4359
"markdownDescription": "%html.customData.desc%",
@@ -188,12 +204,6 @@
188204
"default": true,
189205
"description": "%html.autoClosingTags%"
190206
},
191-
"html.doNotAddAttributeQuotes": {
192-
"type": "boolean",
193-
"scope": "resource",
194-
"default": false,
195-
"description": "%html.doNotAddAttributeQuotes%"
196-
},
197207
"html.hover.documentation": {
198208
"type": "boolean",
199209
"scope": "resource",

extensions/html-language-features/package.nls.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.",
2929
"html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.",
3030
"html.autoClosingTags": "Enable/disable autoclosing of HTML tags.",
31-
"html.doNotAddAttributeQuotes": "Controls whether quotes are automatically added when completing an attribute.",
31+
"html.completion.attributeDefaultValue": "Controls the default value for attributes when completion is accepted.",
32+
"html.completion.attributeDefaultValue.doubleQuotes": "Attribute value is set to \"\".",
33+
"html.completion.attributeDefaultValue.singleQuotes": "Attribute value is set to ''.",
34+
"html.completion.attributeDefaultValue.empty": "Attribute value is not set.",
3235
"html.mirrorCursorOnMatchingTag": "Enable/disable mirroring cursor on matching HTML tag.",
3336
"html.mirrorCursorOnMatchingTagDeprecationMessage": "Deprecated in favor of `editor.linkedEditing`",
3437
"html.hover.documentation": "Show tag and attribute documentation in hover.",

extensions/html-language-features/server/src/modes/htmlMode.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ export function getHTMLMode(htmlLanguageService: HTMLLanguageService, workspace:
2626
if (doAutoComplete) {
2727
options.hideAutoCompleteProposals = true;
2828
}
29-
let doNotAddAttributeQuotes = settings && settings.html && settings.html.doNotAddAttributeQuotes;
30-
if (doNotAddAttributeQuotes) {
31-
options.doNotAddAttributeQuotes = true;
29+
let attributeDefaultValue = settings && settings.html && settings.html.completion.attributeDefaultValue;
30+
if (attributeDefaultValue === 'empty') {
31+
options.useEmptyAttrValue = true;
32+
} else if (attributeDefaultValue === 'singleQuotes') {
33+
options.useSingleQuotesForAttrs = true;
3234
}
3335

3436
const htmlDocument = htmlDocuments.get(document);

0 commit comments

Comments
 (0)