Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

This one of my files that prettier didn't add any semicolons but format it well,

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()

and this is my v-code setting.json

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

and I don't use Eslint

like image 414
Zahal A_Omer Avatar asked Mar 04 '26 04:03

Zahal A_Omer


2 Answers

How I've sorted it after having super huge frustrations with Prettier stopping working in VSCode.

  1. Select VS Code -> View -> Command Palette, and type: Format Document With
  2. Then Configure Default Formatter... and then choose Prettier - Code formatter.

This sorted the problem for me magically.

Depending on your case this might help you...

like image 68
MHAMMED TALHAOUY Avatar answered Mar 05 '26 16:03

MHAMMED TALHAOUY


go to setting and type word semi it will show this if it's not checked then checked it and try again enter image description here

like image 41
Muhammad Bilal Bangash Avatar answered Mar 05 '26 18:03

Muhammad Bilal Bangash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!