简体   繁体   English

在VS Code中打开新的JavaScript文件时,如何在第一行添加“ use strict;”?

[英]How to add “use strict;” on first line when opening a new JavaScript file in VS Code?

How do I add the code "use strict"; 如何添加代码"use strict"; to always appear on Line 1 when opening a new JavaScript file? 在打开新的JavaScript文件时始终显示在第1行上?

It's not clear to me that you can do so without an extension (you could write a snippet and assign it a shortcut but that's not exactly what you want). 对我来说,尚不清楚您是否可以在不扩展的情况下进行操作(可以编写一个代码段并为其分配一个快捷方式,但这并不是您想要的)。 There is, however, an extension that will do that for you: 但是,有一个扩展将为您完成此操作:

https://marketplace.visualstudio.com/items?itemName=veekas.use-strict-everywhere https://marketplace.visualstudio.com/items?itemName=veekas.use-strict-everywhere

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

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