打开 JSX 文件时如何让 VS Code 将语言更改为 JavaScript React [英] How to make VS Code change language to JavaScript React when open a JSX file
问题描述
目前,当我打开一个 .jsx
文件时,默认语言是纯 JavaScript.有没有办法设置编辑器根据文件扩展名更改语言?
Currently, when I open a .jsx
file the default language is plain JavaScript. Is there a way to set the editor to change the language based on the file extension?
理想情况下,我可以将此设置放在本地设置配置文件或工作区特定配置文件中.
Ideally, I can put this setting in both my local setting config file OR the workspace specific config file.
我使用的版本是Version 1.15.0-insider (1.15.0-insider)
.
推荐答案
在 VS Code 中,在窗口的右下角,您将看到一个笑脸 - 左边是当前可见文件所关联的语言(例如 JavaScript).确保您当前打开的文件是 .jsx 文件.
Within VS Code, in the bottom right of the window you will see a smiley face - to the left of that is the language the currently visible file is associated with (e.g. JavaScript). Ensure your currently opened file is a .jsx file.
单击此按钮将在顶部显示一个菜单.点击Configure File Association for '.jsx'...
,然后选择JavaScript React".
Clicking this will reveal a menu at the top. Click the Configure File Association for '.jsx'...
, and then choose "JavaScript React".
这篇关于打开 JSX 文件时如何让 VS Code 将语言更改为 JavaScript React的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!