razor icon indicating copy to clipboard operation
razor copied to clipboard

Bug: VS 2022 cshtml file breaks javascript formatting

Open vsfeedback opened this issue 2 years ago • 3 comments

This issue has been moved from a ticket on Developer Community.


[severity:It’s more difficult to complete my work] [regression] [worked-in:VS 2019]
Javascript usually has nicely coloured fonts for reserved words and strings. But if the html code above the js has an html style comment starting with <!-- inside a cs block (which starts with the @ symbol) then the formatting is lost.

<!-- This comment is fine  -->
@if (1 == 1)
{
    // This comment works fine here
    <!-- But this one breaks the javascript highlighting below just by existing inside the if loop -->
    <h3 class="page-title" id="PageTitle"><b><u>Blah blah</u></b></h3>
}

<script>
    var loading = true;
    // blah
</script>


Original Comments

Feedback Bot on 8/28/2023, 06:30 PM:

(private comment, text removed)

Feedback Bot on 9/5/2023, 03:32 AM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Nov 30 '23 22:11 vsfeedback

@davidwengier @333fred Is this likely to be a parsing issue? That the compiler is incorrectly reporting the tree and the tooling is thus doing the wrong thing?

chsienki avatar Dec 08 '23 19:12 chsienki

This would most likrly be a TextMate grammar issue, not compiler.

davidwengier avatar Dec 08 '23 19:12 davidwengier

VS Code also has this issue too.

howing0345 avatar May 08 '24 03:05 howing0345