Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 VS Code 更漂亮的插件来格式化我的代码,如何在格式化代码时添加一个设置以不添加或删除分号?我知道这个功能是在一月份添加的,但我在 PR 或问题中没有提到如何将它添加到设置中。
从自述文件:
prettier.semi (默认: true) 是否在每行的末尾添加分号(semi:true),或者仅在可能导致 ASI 失败的行的开头添加分号(semi:false)
prettier.semi (默认: true)
是否在每行的末尾添加分号(semi:true),或者仅在可能导致 ASI 失败的行的开头添加分号(semi:false)
您必须设置prettier.semi为false.
prettier.semi
false
要更改更漂亮的设置,请参阅,
像所有其他 vscode 设置一样 注意:这些设置以 prettier 为前缀。
像所有其他 vscode 设置一样
注意:这些设置以 prettier 为前缀。
打开settings.json文件*。
settings.json
添加此行以在保存时格式化代码并在保存时删除分号:
"editor.formatOnSave": true, "prettier.semi": false,
使用 Ctrl+P 在 Vs Code 中搜索文件。*