简体   繁体   English

VS 代码中更漂亮的扩展不起作用,我尝试了包括 yt 教程在内的所有内容,但我所做的一切都没有帮助

[英]Prettier extension in VS code is not working, I tried everything including yt tutorials and what ever i did nothing helped

im desperate, finaly made myself study some react and guess what, cant even start cuz suddenly my settings are messed up.我绝望了,最后让自己研究了一些反应并猜猜是什么,甚至无法启动因为突然我的设置搞砸了。 When ever I try to save to auto format nothing happens.每当我尝试保存为自动格式时,什么都没有发生。 I really tried everything from here on stackoverflow and even yt but nothing really helped...Gonna show you my code: this is how it looks like after I press ctrl+s to save the file and to format it...我真的在 stackoverflow 甚至 yt 上尝试了这里的所有内容,但没有任何帮助...将向您展示我的代码:这是我按 ctrl+s 保存文件并格式化后的样子...

Like a week ago everything worked well and somehow I messed up the settings.就像一周前一样,一切都运行良好,不知何故我搞砸了设置。 Would be helpful if someone sent me his settings.json because Ive tried some Ive found on google and none helped.如果有人向我发送他的 settings.json 将会很有帮助,因为我尝试了一些我在谷歌上找到的但没有帮助。 I really wanna study React but this wont let me.我真的很想学习 React,但这不会让我。 I know I can use codesandblox but its not it...Thx in advance...我知道我可以使用codesandblox,但不是它......提前谢谢......

You need to set your default formatter to Prettier and enable format on save.您需要将默认格式化程序设置为 Prettier 并在保存时启用格式化。

Default Formatter To ensure that this extension is used over other extensions you may have installed, be sure to set it as the default formatter in your VS Code settings.默认格式化程序为确保此扩展程序用于您可能已安装的其他扩展程序,请务必在 VS Code 设置中将其设置为默认格式化程序。 This setting can be set for all languages or by a specific language.可以为所有语言或特定语言设置此设置。 The following will use Prettier for only Javascript.以下将仅对 Javascript 使用 Prettier。

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

Format On Save Respects editor.formatOnSave setting.格式保存尊重 editor.formatOnSave 设置。

You can turn on format-on-save on a per-language basis by scoping the setting:您可以通过限定设置的范围,在每种语言的基础上启用 format-on-save:

// Set the default
"editor.formatOnSave": false,
// Enable per-language
"[javascript]": {
    "editor.formatOnSave": true
}
{
    "git.autofetch": true,
    "terminal.explorerKind": "external",
    "files.autoSave": "afterDelay",
    "terminal.integrated.profiles.windows":{"Git Bash":{"path":"C:\\Program Files\\Git\\bin\\bash.exe"},  },
"terminal.integrated.defaultProfile.windows": "Git Bash",
"editor.formatOnSave": true,
"html.format.indentHandlebars": true,
"html.format.indentInnerHtml": true,
"settingsSync.ignoredExtensions": [
],
"[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更漂亮的扩展在 vs 代码中不起作用需要配置设置为 true - Prettier extension is not working in vs code Require config set to true 将 prettier 安装为 NPM package 和在 VS Code 中安装 prettier 扩展有什么区别 - what is the difference between installing prettier as a NPM package and installing prettier extension in VS Code VS 代码中断语句中更漂亮的扩展 - Prettier extension in VS code breaks statement 我正在读取未定义的属性 map。我已经尝试了一切但没有任何效果 - I am getting read property map of undefined.I have tried everything but nothing worked React 一直在说。map 不是 function 并且我尝试过的没有任何工作? - React keeps saying .map is not a function and nothing I have tried is working? Javascript 分配有问题:数组和 object 迭代但我不知道解决方案是什么,我已经尝试了一切 - Having a problem with a Javascript assignment: Array and object iteration but I have no idea what the solution is, I have tried everything Javascript 分配有问题,我不知道解决方案是什么,我已经尝试了一切 - Having a problem with a Javascript assignment and I have no idea what the solution is, i have tried everything 如何在基于ajax html5的网站模板http://www.musicep.com/上插入adsense? 我尝试了一切,但无济于事 - How to insert adsense on my ajax html5 based website template http://www.musicep.com/ ? I tried everything but nothing works 当我添加“”时,我尝试与我的 javascript 链接的按钮 onlick 似乎不起作用或在我的 vs 代码上突出显示橙色 - button onlick that i tried linking with my javascript doesn't seem to be working or highlighting orange on my vs code when i add the “” 我的 bootstrap 下拉菜单不起作用,我尽我所能使它起作用 - My bootstrap dropdown is not working and I tried everything to make it work as per my knowledge
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM