Reputation: 11
How can I make a block comment in React (JavaScript) use single line comment notation of // not /* } */ in VS Code
Please see block comment of /* ... */ vs // ...
Example of what I do not want:
{/* <App>
<Home />
</App> */}
Example of what I do want:
// <App>
// <Home />
// </App>
Example 2 of alternative of what I do want, a per line commenting not block commenting:
{/* <App> */}
{/* <Home /> */}
{/* </App> */}```
Upvotes: 1
Views: 1252
Reputation: 180945
If a simple Ctrl+/ does not work for you when selescting multiple lines - I think it should put a line comment on each line, then consider the extension below.
Take a look at this extension (that I wrote): Toggle Line Comments. It does what you want. Some keybinding:
{
"key": "alt+/", // whatever keybinding you want
"command": "toggle-comments.toggleLineComments",
"when": "editorTextFocus && editorLangId == javascriptreact"
}
If you want to restrict it to javascriptreact
files, use the full when clause above. In which case you could use Ctrl+/ as the keybinding if you wanted to.
Upvotes: 1