vscode-inline-html icon indicating copy to clipboard operation
vscode-inline-html copied to clipboard

Bug: wrong comment syntax inside <style> tags

Open dev-nicolaos opened this issue 3 years ago • 2 comments

Environment Observed In

Extension version: v0.3.5 VS Code version: 1.69.1 OS: Windows 11

Steps to reproduce

  • In a Javascript or Typescript file, paste the following:
    const markup = /*html*/`
      <style>
    
      </style>
    `;
    
  • Place the cursor on the blank line
  • Execute the Toggle Line Comment (command id is editor.action.commentLine) command
    • By default on Windows this command is bound to ctrl+/

Expected Behavior

The editor adds the sequence /* */ (CSS comment) in place as it does when you execute the same command inside a <style> tag in an HTML file.

Observed Behavior

The editor adds the sequence <!-- --> (HTML comment) in place.

dev-nicolaos avatar Jul 16 '22 17:07 dev-nicolaos

@dev-nicolaos yeah i know about this issue although i haven't figured out exactly why does vscode do this, because the html language server is able to understand the <style> blocks in normal html files.

pushqrdx avatar Jul 27 '22 15:07 pushqrdx

As a workaround, you can bind the command "Emmet: Toggle Comment" to a keyboard shortcut (maybe Ctrl + Shift + /) and use that to comment HTML and/or CSS in a template string.

conor-dowdall avatar Oct 24 '23 15:10 conor-dowdall