javascript - 为什么 prettier.semi 不在我的 JavaScript 文件中添加任何分号?
问题描述
这是我的一个更漂亮的文件,没有添加任何分号,但格式很好,
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-code setting.json
{
"workbench.colorTheme": "Visual Studio Light",
"security.workspace.trust.untrustedFiles": "open",
"prettier.semi": true
}
而且我不使用 Eslint
解决方案
在对 Prettier 停止在 VSCode 中工作感到非常沮丧之后,我是如何对其进行排序的。
- 选择
VS Code
->View
->Command Palette
,然后输入:Format Document With
- 然后
Configure Default Formatter
……然后选择Prettier - Code formatter
。
这神奇地为我解决了问题。
根据您的情况,这可能会帮助您...
推荐阅读
- ios - 无法执行存储在 Array[Any] 中的对象的方法
- mysql - 检查 docker-compose up 并且 db 已经启动
- javascript - 未捕获的错误:在窗口上找不到物化对象
- opencart - 尝试在扩展中获取模块列表时,为什么会收到 500(内部服务器错误)?
- java - 来自接口的 Java 类型推断
- r - h2o 中的分类编码 - 测试集
- java - 从两个列表的组合中形成新的小列表
- javascript - HTML5 Geolocation API 在 Firefox 中不起作用
- c++ - 释放 COM 指针的异常
- sql-server - Transact-SQL:使用表 2 中的可选连接属性连接两个表