最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React suggestions and autocomplete does not work for files with js extension in VSCode - Stack Overflow

programmeradmin3浏览0评论

I need to enable React related suggestions and autoplete but in files with .js extension in Visual Studio Code. The only way to make it working for me is to change extension from .js to .jsx. I tried everything described in this post but nothing worked for me.

Here is what I mean by React related suggestions and autoplete.

I need to enable React related suggestions and autoplete but in files with .js extension in Visual Studio Code. The only way to make it working for me is to change extension from .js to .jsx. I tried everything described in this post but nothing worked for me.

Here is what I mean by React related suggestions and autoplete.

Share Improve this question asked Jun 8, 2020 at 17:28 Mark LadyshevMark Ladyshev 411 silver badge5 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

"*.jsx" extension assosiacted with javascriptreact language mode.

Change the file type from javascript to javascriptreact, you can do it from the bottom panel.

Or run Change language Mode from mand palette (ctrl+p).

Also, you can add files.associtiations on your settings.json:

  "files.associations": {
    "*.react.js": "javascriptreact",
    "*.jsx": "javascriptreact",
    "*.js": "javascriptreact",
  }

I was having an issue with React autoplete not working in my development environment. After some investigation, I found a solution that resolved the problem.

The issue was that React autoplete suggestions were not appearing as expected. I discovered that installing the @types/react package fixed the problem. Here’s the mand I used to install it:

  • npm i @types/react

I am also having same problem but when I keep index.js file open in background everything just works. You can also try

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论