繁体   English   中英

为什么 prettier.semi 不在我的 JavaScript 文件中添加任何分号?

[英]why prettier.semi not adding any semicolons on my JavaScript files?

这是我的一个更漂亮的文件,没有添加任何分号,但格式很好,

function usercreate(name,score){
        this.name = name 
        this.score = score
        }
        usercreate.prototype.increment=function(){
            this.score++
            console.log(this.score)
        }
        usercreate.prototype.login=function(){
            console.log("loged in")
        }
    const user1=new usercreate("zahal",100)
    user1.increment()
    user1.login()
    const user2=new usercreate("sam",01)
    user2.increment()
    user2.login()

这是我的 v 代码设置。json

{
    "workbench.colorTheme": "Visual Studio Light",
    "security.workspace.trust.untrustedFiles": "open",
    "prettier.semi": true
}

而且我不使用 Eslint

在对 Prettier 停止在 VSCode 中工作感到非常沮丧之后,我是如何对它进行排序的。

  1. Select VS Code -> View -> Command Palette ,然后输入: Format Document With
  2. 然后Configure Default Formatter ... 然后选择Prettier - Code formatter

这神奇地为我解决了问题。

根据您的情况,这可能会帮助您......

go 设置并键入 word semi 如果未选中,它将显示此内容,然后选中并重试在此处输入图像描述

在此处输入图像描述

在设置搜索栏中写下这些词,并确保将默认选项更改为插入选项我希望这对您有所帮助。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM