diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 1a6dfb2e6a..c1d48a371b 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -398,6 +398,19 @@ "vue.format.script.initialIndent": { "type": "boolean", "default": false + }, + "vue.format.wrapAttributes": { + "type": "string", + "default": "auto", + "enum": [ + "auto", + "force", + "force-aligned", + "force-expand-multiline", + "aligned-multiple", + "preserve", + "preserve-aligned" + ] } } }, diff --git a/packages/language-service/lib/plugins/vue-sfc.ts b/packages/language-service/lib/plugins/vue-sfc.ts index a911210849..823f3d7d32 100644 --- a/packages/language-service/lib/plugins/vue-sfc.ts +++ b/packages/language-service/lib/plugins/vue-sfc.ts @@ -36,7 +36,7 @@ export function create(): LanguageServicePlugin { return { ...options, ...formatSettings, - wrapAttributes: 'auto', + wrapAttributes: await context.env.getConfiguration?.('vue.format.wrapAttributes') ?? 'auto', unformatted: '', contentUnformatted: blockTypes.join(','), endWithNewline: options.insertFinalNewline ? true