漂亮的不正确格式化Java脚本代码
import React from "react";
export const todo = () => {
return <div > todo works! < /div>;
};
这是我的设置。json of Prettier,
{
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb",
"*.class": "default"
},
"workbench.iconTheme": "vscode-icons",
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"C_Cpp.updateChannel": "Insiders",
"code-runner.runInTerminal": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"workbench.colorTheme": "Material Theme Ocean",
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
"[kotlin]": {
"editor.defaultFormatter": "fwcd.kotlin"
},
"editor.formatOnSave": true,
"workbench.editor.defaultBinaryEditor": "default"
}
当我保存和格式化代码时,开头标签与DIV/的后斜线之间总是有一个空间。由于发生了此错误,我无法将todo.js文件导入到主应用程序中。
import React from "react";
export const todo = () => {
return <div > todo works! < /div>;
};
this is my settings.json code of Prettier,
{
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb",
"*.class": "default"
},
"workbench.iconTheme": "vscode-icons",
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"C_Cpp.updateChannel": "Insiders",
"code-runner.runInTerminal": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"workbench.colorTheme": "Material Theme Ocean",
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
"[kotlin]": {
"editor.defaultFormatter": "fwcd.kotlin"
},
"editor.formatOnSave": true,
"workbench.editor.defaultBinaryEditor": "default"
}
When I save and format the code, there's always a space between the opening tag and the back slash of div/. due to this error occurring and I am unable to import the todo.js file into the main app.js file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用“美化扩展”。
在扩展中找到并下载。
然后切换您的默认格式以美化。
Try using the beautify extension.
Find it in extensions and download.
Then switch your default formatter to beautify.
将其添加到您的
settings.json
Add this to your
settings.json