[英]Can't auto create jsconfig.json in Visual studio as green bulb is missing
I want to create a jsconfig.json file, but Visual studio is not showing me the green bulb that allows me to do this. 我想创建一个jsconfig.json文件,但是Visual Studio并未向我展示允许我执行此操作的绿色灯泡。 I'm used to finding the green bulb at the bottom right of the editor like this image is showing. 我习惯于在编辑器右下角找到绿色灯泡,如该图所示。
Why can't I see the green bulb? 为什么看不到绿色灯泡?
Writing jsconfig.json 编写jsconfig.json
When VS Code detects that you are working on a JavaScript file , it looks to see if you have a JavaScript configuration file jsconfig.json in your workspace. 当VS Code 检测到您正在处理JavaScript文件时 ,它会查看您的工作区中是否有JavaScript配置文件jsconfig.json。 If it doesn't find one, you will see a green lightbulb on the Status Bar prompting you to create one. 如果找不到,您将在状态栏上看到绿色的灯泡,提示您创建一个。 Click the green lightbulb and accept the prompt to create a jsconfig.json file. 单击绿色灯泡并接受提示以创建jsconfig.json文件。 ( source ) ( 来源 )
It looks like the availability of the green lightbulb is determined by the currently opened file being a javascript file. 看起来绿色灯泡的可用性取决于当前打开的文件是javascript文件。
Otherwise just create a jsconfig.json
file yourself: 否则,您自己创建一个jsconfig.json
文件:
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules"
]
}
TypeScript now infers the JavaScript project if no jsconfig.json
is found. 现在,如果找不到jsconfig.json
TypeScript会推断JavaScript项目。 This means that the green light bulb hint about creating a jsconfig.json
file is not required so it was removed from vscode in November iteration (1.7.0 or 1.7.1). 这意味着不需要绿色灯泡提示有关创建jsconfig.json
文件的信息,因此已在11月迭代(1.7.0或1.7.1)中将其从vscode中删除。 The vscode documentation was not yet updated to reflect that change. vscode文档尚未更新以反映该更改。
Related PR: vscode/pull/15213 Related plan item: vscode/issues/15205 相关PR: vscode / pull / 15213相关计划项目: vscode / issues / 15205
tl;dr Starting from vscode 1.7.1 you don't need the jsconfig.json
file unless you are overwriting/extending default setting. tl; dr从vscode 1.7.1开始,除非覆盖/扩展默认设置,否则不需要jsconfig.json
文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.