Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code HTML wrong comment type

I recently used VS code for Wordpress development but I encountered a weird bug when I comment with (ctrl+/) to an html element. Instead of commenting (<!-- -->) it uses (//) for my html code? Has anybody experience this? Do you know of any solutions to change the comment to the correct html comment?

Animated GIF

like image 226
Leo Salayog Avatar asked Jul 01 '17 06:07

Leo Salayog


People also ask

How do I comment HTML code in VSCode?

If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code.

How do you comment in HTML code?

In HTML, a comment is text enclosed within < ! ╌ ╌> tags. This syntax tells the browser that they are comments and should not be rendered on the front end. Thanks to the comments tag, you can leave notes to remind yourself where you left off in the build process.


1 Answers

This is caused by VS Code improperly auto-detected programming language - in the lower right corner of your GIF you can clearly see, that VS Code is set to HTML. Click on that button, and switch over to JavaScript (React) and problem should be solved.

like image 175
Artanis Avatar answered Sep 21 '22 08:09

Artanis