[英]I would like to format my html code in VS Code
my html code in my angular component, i automatically have:我的 angular 组件中的 html 代码,我自动拥有:
<a
class="text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-no-wrap uppercase text-white"
href="#pablo"
>
pink Color
</a>
<button
class="cursor-pointer text-xl leading-none px-3 py-1 border border-solid border-transparent rounded bg-transparent block lg:hidden outline-none focus:outline-none"
type="button"
>
<span class="block relative w-6 h-px rounded-sm bg-white"></span>
<span
class="block relative w-6 h-px rounded-sm bg-white mt-1"
></span>
<span
class="block relative w-6 h-px rounded-sm bg-white mt-1"
></span>
</button>
While I would like that:虽然我想这样:
<a class="text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-no-wrap uppercase text-white" href="#pablo">
pink Color
</a>
<button class="cursor-pointer text-xl leading-none px-3 py-1 border border-solid border-transparent rounded bg-transparent block lg:hidden outline-none focus:outline-none" type="button">
<span class="block relative w-6 h-px rounded-sm bg-white"></span>
<span class="block relative w-6 h-px rounded-sm bg-white mt-1"></span>
<span class="block relative w-6 h-px rounded-sm bg-white mt-1"></span>
</button>
I search on my settings.json but i don't know where i can't change that... Any Suggestions?我在我的 settings.json 上进行搜索,但我不知道在哪里无法更改...有什么建议吗?
For a better and current pattern, go in your extensions tab and download Prettier and ESLint.要获得更好和最新的模式,请在扩展选项卡中的 go 并下载 Prettier 和 ESLint。
So, in your settings you can add:因此,在您的设置中,您可以添加:
"[javascript, angular, html, css, json]": {
"editor.formatOnSave": true
},
"eslint.quiet": true,
"editor.codeActionsOnSave": {
"eslint.autoFixOnSave": true,
},
Or edit for any language you want to vscode act.或者编辑任何你想要 vscode 行为的语言。
This will make the code always as readable as possible regardless of the length of the code line.无论代码行的长度如何,这将使代码始终尽可能地可读。
I find the solution.我找到了解决方案。 Add this lines in settings.json在 settings.json 中添加这一行
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.