admin管理员组文章数量:1379427
As above, and presented in the screenshot.
Using Format document on valid JS code (no space between question marks) produces errors.
What I've tried so far was to change formatter, but to no avail. Error is especially irritating because I have formatting on save option on and I like it that way. Studio version is 1.46.
If you want to reproduce it yourself, feel free:
let iForgotToInitializeThat = undefined;
const coalesceResult = iForgotToInitializeThat ?? 'something';
And try to format it.
As above, and presented in the screenshot.
Using Format document on valid JS code (no space between question marks) produces errors.
What I've tried so far was to change formatter, but to no avail. Error is especially irritating because I have formatting on save option on and I like it that way. Studio version is 1.46.
If you want to reproduce it yourself, feel free:
let iForgotToInitializeThat = undefined;
const coalesceResult = iForgotToInitializeThat ?? 'something';
And try to format it.
Share Improve this question asked Jun 18, 2020 at 13:13 matek997matek997 3511 silver badge13 bronze badges 4- Everything working. – demkovych Commented Jun 18, 2020 at 13:15
- what's the ?? for – William Ku Commented Jun 18, 2020 at 13:16
-
Install
Nullish Coalescing Operator Grammar
– demkovych Commented Jun 18, 2020 at 13:18 - @WilliamKun developer.mozilla/en-US/docs/Web/JavaScript/Reference/… – matek997 Commented Jun 18, 2020 at 13:22
4 Answers
Reset to default 5I've tried your code and it works properly in my case, but have prettier formatter extension configured to format my code, maybe you can try it.
Hope it helps :)
If you use Beautify then it will indicate an error. Try to use Prettier.
In my case, a formatter was installed along side prettier, which was deprecated and causing spaces. Its always good idea to disable extensions one by one and see which is causing problem.
In my case, I removed Beautify that is a deprecated extension. and then that problem was fixed.
本文标签: VS Code code formatting JavaScript incorrectlyStack Overflow
版权声明:本文标题:VS Code code formatting JavaScript incorrectly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744455008a2606946.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论