Sunday, May 6, 2018

VS Code — commenting .jsx syntax

Leave a Comment

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

2 Answers

Answers 1

Just change the language to JavaScript React (Babel) instead of JavaScript (Babel).

    "language": "javascript",     "scopeName": "source.js",     "path": "./syntaxes/JavaScript.tmLanguage.json",     "embeddedLanguages": {       "meta.tag.js": "jsx-tags",       "meta.tag.without-attributes.js": "jsx-tags",       "meta.tag.attributes.js": "javascript",       "meta.embedded.expression.js": "javascript"     }, 

Also if you use Sublime Babel first disable it and then switch to React. https://github.com/Microsoft/vscode/blame/master/extensions/javascript/package.json#L72

Answers 2

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

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment