【发布时间】:2022-01-17 15:08:50
【问题描述】:
我需要这个:
var short_sleeve = {
type: "Short Sleeve",
id: this.item.epos_code,
};
看起来像这样:
var short_sleeve = { type: "Short Sleeve", id: this.item.epos_code, };
这是我的 prettierrc.json:
{
"bracketSpacing": false,
"endOfLine": "auto",
"printWidth": 300,
"proseWrap": "never",
"tabWidth": 4,
"trailingComma": "all",
"useTabs": true
}
这是我的 vs 代码 settings.json
{
"prettier.singleQuote": true,
"prettier.tabWidth": 4,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.printWidth": 300,
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true,
"diffEditor.ignoreTrimWhitespace": false,
"prettier.proseWrap": "never",
"materialTheme.accent": "Acid Lime",
"twig-language.wrap": 100
}
我在这里尝试了解决方案:Prevent Prettier from converting single line object declarations into multi line in Visual Studio Code?。什么都没有
这与解决方案无关,因为 HTML 工作正常:How do you stop Prettier in VS code splitting attributes onto multiple lines?
我玩过 printWidth,将其设置为 1000。没有。 我检查过没有安装和运行其他格式化程序。还是什么都没有。
不知道为什么它不会将较小的对象压缩到一条线上。
【问题讨论】:
标签: javascript json formatting vscode-settings prettier