html.tmbundle icon indicating copy to clipboard operation
html.tmbundle copied to clipboard

Embedded javascript string with `//` have unexpected behavrio

Open alexr00 opened this issue 4 years ago • 3 comments

Original from @Namorzyny in https://github.com/microsoft/vscode/issues/105779

Steps to Reproduce:

  1. Input some code like: <input type="button" value="text" onclick="location.href='https://www.google.com'">
  2. The code will display as a comment:

コメント 2020-09-01 083349

This only occurs if the // is in the string. The character before the // will get invalid.illegal.newline.js.

alexr00 avatar Sep 29 '20 09:09 alexr00

This issue doesn't occur with just the javascript grammar, only when its embedded like this.

alexr00 avatar Sep 29 '20 09:09 alexr00

Thanks to some investigation from @mjbvz, the issue appears to be here: https://github.com/textmate/html.tmbundle/blob/0c3d5ee54de3a993f747f54186b73a4d2d3c44a2/Syntaxes/HTML.plist#L341-L359

Original comment is https://github.com/microsoft/vscode/issues/112189#issuecomment-742157879

alexr00 avatar Dec 30 '20 15:12 alexr00

Well, same will happen when you use /* as well

rahul3v avatar Jan 06 '21 06:01 rahul3v