在 Visual Studio Code 中将语言更改为 JSX [英] Change language to JSX in Visual Studio Code

查看:44
本文介绍了在 Visual Studio Code 中将语言更改为 JSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio Code 现在在 0.8 版本上支持 JSX,但看起来是激活它的唯一方法带有 .jsx 文件扩展名.手动更改语言模式不在列表中,最接近的选项是 JavaScriptReact,但它不会解析 JSX 标签.

Visual Studio Code now supports JSX on 0.8 version, but looks like the only way to activate it is with a .jsx file extension. It is not on the list to change the language mode manually, the nearest option is JavaScriptReact, but it doesn't parse the JSX tags.

我在一个包含很多带有 JSX 的 .js 文件的项目中,我无法更改它.

I'm in a project with a lot of .js files with JSX and I can't change it.

在没有 .jsx 扩展名的情况下,还有其他方法可以使用 JSX 语法吗?

Is there any other way to use JSX syntax without the .jsx extension?

推荐答案

更改您的用户设置或工作区设置如下:

Change your user settings or workspace settings as below:

// Place your settings in this file to overwrite the default settings
{
    "files.associations": {
        "*.js": "javascriptreact"
    }
}

注意:您可能需要重新启动 VSCode.

Note: You might need to restart VSCode.

这篇关于在 Visual Studio Code 中将语言更改为 JSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆