9

I checked previous questions on SO here and here and VS Code's issues here and here.

I still don't know how I can comment jsx syntax in VS Code by cmd + /. I tried syntax JavaScript React and JavaScript Babel and add:

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

into user settings. Nothing helped. When I check Developer Tools, there are no error messages.

recording

Matt
  • 8,195
  • 31
  • 115
  • 225
  • What software did you use for the gif? I usually don't get such good quality – Tarun Lalwani Apr 29 '18 at 17:59
  • I use [kap](https://getkap.co/) – Matt Apr 29 '18 at 18:35
  • It works for me, Remember Atom has this behavior, but VSCode looks a bit intelligent around this area. https://i.imgur.com/3D3lKhn.gifv. Also look at the plugins i have installed. There may be some plugin is that changing the behavior for you. I have no custom file associations defined. Also I am on the latest and greatest version of VSCode – Tarun Lalwani Apr 29 '18 at 18:51
  • This is really good idea, I will try it out. Thank you. – Matt Apr 30 '18 at 09:17
  • I had this issue because of [Babel ES6/ES7](https://github.com/dzannotti/vscode-babel) plugin. I found the answer [here](https://stackoverflow.com/a/50090419/968379) – Matt May 07 '18 at 11:49

2 Answers2

14

If you have Babel ES6/ES7 plugin installed, disable it. Editor comments .jsx syntax by // instead of {/*. You see see the issue here.

Andrej Gajdos
  • 915
  • 7
  • 10
  • @Green please, when you comment something and downvote answers, check some information. You don't need Babel plugin for syntax highlighting, because VS Code has built-in support for JSX and TSX. – Andrej Gajdos Jul 02 '18 at 14:53
1

It works for me, Remember Atom has this behavior, but VSCode looks a bit intelligent around this area.

Working

I have no custom file associations defined. Also I am on the latest version of VsCode. Make sure you have no additional addins that takeover and change the behavior

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265