[英]How do I update my config file in vs code?
When I see example config files on VS Code they are often lengthy and offer two panels for updating (one for default settings and the other for customization).当我在 VS Code 上看到示例配置文件时,它们通常很长,并提供两个更新面板(一个用于默认设置,另一个用于自定义)。 For some reason my config file is only a few lines and whenever I try to update it, nothing happens:
出于某种原因,我的配置文件只有几行,每当我尝试更新它时,什么也没有发生:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
For example I'm trying add a line of code to get rid of the error displayed for using .jsx in a .js file as found here and here but it doesn't work.例如,我正在尝试添加一行代码以消除在 .js 文件中使用 .jsx 显示的错误,如此处和此处所示,但它不起作用。 This is just an example, I've tried other modifications as well.
这只是一个例子,我也尝试过其他修改。 How do I add the below code my launch.json (and is there more than one launch.json?).
我如何将下面的代码添加到我的 launch.json(是否有多个 launch.json?)。 As you can see, I'm super new to this so thanks for any help.
如您所见,我对此非常陌生,因此感谢您的帮助。
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
}
You can open:您可以打开:
All these you can find in UI instead of JSON.所有这些都可以在 UI 而不是 JSON 中找到。
In your example, you provided Launch configuration (it is not vs code settings), it is used to configure how to launch/debug your application.在您的示例中,您提供了 Launch 配置(它不是 vs 代码设置),它用于配置如何启动/调试您的应用程序。
And if you want to get rid of errors, you don't need to use VS Code settings.如果你想摆脱错误,你不需要使用 VS Code 设置。 These rules:
这些规则:
"rules": { "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], }
"rules": { "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], }
are configuration for eslint plugin (based on links you provided).是 eslint 插件的配置(基于您提供的链接)。 So, you need to place these lines to
.eslintrc
file and eslint and appropriate plugins should be installed and properly configured.因此,您需要将这些行
.eslintrc
文件中,并且应该安装并正确配置 eslint 和适当的插件。
The launch.json file is used for launching commands like building, running or debugging, you need to change some settings, not launching any thing. launch.json 文件用于启动构建、运行或调试等命令,您需要更改一些设置,而不是启动任何东西。 vsCode offers you couple of ways to declare your settings:
vsCode 为您提供了几种声明设置的方法:
On vsCode docs you can read all about it.在 vsCode 文档上,您可以阅读所有相关内容。
You can edit your settings by ctrl + shift + p to open the command palette and search settings, or File > Preferences > Settings (Code > Preferences > Settings on Mac).您可以通过ctrl + shift + p打开命令面板和搜索设置,或通过文件 > 首选项 > 设置(Mac 上的代码 > 首选项 > 设置)编辑您的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.