Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS within HTML is commented using HTML comments #30

Open
josephrocca opened this issue Jan 21, 2020 · 1 comment
Open

JS within HTML is commented using HTML comments #30

josephrocca opened this issue Jan 21, 2020 · 1 comment

Comments

@josephrocca
Copy link

I have a .html file that contains only this text:

<script>
  let a = 1;
  let b = 2;
</script>

If I highlight the two lines of javascript and press alt+/, it turns into this:

<script>
 <!-- let a = 1; -->
 <!-- let b = 2; -->
</script>

when it should instead turn into this:

<script>
  // let a = 1;
  // let b = 2;
</script>

Not a huge deal but it would be nice if it could handle scripts embedded within HTML like this.

Thanks for the great plugin in any case! :)

@M-DVD
Copy link

M-DVD commented May 3, 2021

The same happens if you have a PHP file with HTML embedded. The HTML will be commented using // instead <!-- -->

So, I guess it's happening with "multi-languages" files, the comment type is not detected according to the section of the code.
I didn't test but I bet the same would happen if you have CSS in the HTML file, or CSS in the HTML in the PHP file, or etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants