VS Code Tips - Fix Multiline Comments in CSS/HTML

Published: 26 March 2024
on channel: CSS Weekly
1,407
91

Visual Studio Code tip showing you how to fix broken block comments behavior in CSS/HTML when toggling a comment adds a new comment instead of uncommenting the focused comment.

EDIT: Jayden Pearse noted in the comments that you can use "resourceLangId" instead of "resourceExtname," which will also work on files without an extension, as long as the correct language (CSS or HTML) is detected or set manually.

BETTER When Expression: editorTextFocus && !editorReadonly && (resourceLangId == 'html' || resourceLangId == 'css')

When Expression shown in the video: editorTextFocus && !editorReadonly && (resourceExtname == '.css' || resourceExtname == '.html')

Subscribe to CSS Weekly Newsletter:
💌 https://css-weekly.com/

Help support my channel
👨‍🎓 Get a course: https://masteringlinting.com/
🪧 Buy a CSS sticker pack: https://stickers.css-weekly.com
💖 Support me on Patreon:   / cssweekly  

📖 Chapters
00:00 Problem with block comments in VS Code
01:39 Use Emmet to toggle block comments in CSS/HTML
02:23 Add Keyboard Shortcut to “Emmet: Toggle Comment” command
03:33 Restrict Keyboard Shortcut to CSS & HTML files
06:49 Why you should use Emmet Toggle Comments command in VS Code

Keep up-to-date with CSS Weekly:
🐦 Twitter:   / @cssweekly  
🎶 TikTok:   / cssweekly  
🎇 Instagram:   / cssweekly  
📘 Facebook:   / cssweekly  

Keep up to date with what I'm up to:
👨‍💼 Blog: https://zoranjambor.com
💼 LinkedIn:   / zoranjambor  

Zoran Jambor
#css #vscode


On this page of the site you can watch the video online VS Code Tips - Fix Multiline Comments in CSS/HTML with a duration of hours minute second in good quality, which was uploaded by the user CSS Weekly 26 March 2024, share the link with friends and acquaintances, this video has already been watched 1,407 times on youtube and it was liked by 91 viewers. Enjoy your viewing!