漂亮的不正确格式化Java脚本代码

发布于 2025-02-09 03:43:51 字数 1209 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笨死的猪 2025-02-16 03:43:51

尝试使用“美化扩展”。
在扩展中找到并下载。
然后切换您的默认格式以美化。

Try using the beautify extension.
Find it in extensions and download.
Then switch your default formatter to beautify.

你在我安 2025-02-16 03:43:51

将其添加到您的settings.json

"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[javascriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },

Add this to your settings.json

"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[javascriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文