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

Format Document adding empty comments /**/ in CSHTML files #37660

Open
vsfeedback opened this issue Aug 1, 2019 · 4 comments
Open

Format Document adding empty comments /**/ in CSHTML files #37660

vsfeedback opened this issue Aug 1, 2019 · 4 comments
Labels
Area-IDE Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-Formatter Code formatter and/or smart indent
Milestone

Comments

@vsfeedback
Copy link

vsfeedback commented Aug 1, 2019

When using Format Document in CSTHML files I am getting /**/ appearing immediately following inline If statements, the empty comment string wouldnt be as much of an issue if it wasn't appearing in the rendered HTML for the View and if my View didnt have a dozen If statements and thus a dozen lines with /**/ appearing every time format document is used. Also, if ran a second time, Format Document creates two /**/ on subsequent lines, so my dozen becomes 24, then 36 etc and all of them appear in the rendered HTML.

How do I stop this? I have already spoke to Progress about the specific control in question and they say they have seen similiar issues and it is a Format Document problem outside of their control.

Original Code:

@(Html.Kendo(). PanelBar()
    . Name("panelbar")
    . ExpandMode(PanelBarExpandMode.Single)
    . Items(panelbar => {
        panelbar. Add(). Text("My Teammates")
            . Expanded(true)
            . Content(@<div style="padding: 10px;">
            @if (true == true)
                        {
                <div class="teamMate">
                    <img src="@Url.Content("~/shared/web/panelbar/andrew.jpg")" alt="Andrew Fuller">
                    <h2>Andrew Fuller</h2>
                    <p>Team Lead</p>
                </div>
                        }
        </div>);

Formatted Code:

@(Html.Kendo(). PanelBar()
    . Name("panelbar")
    . ExpandMode(PanelBarExpandMode.Single)
    . Items(panelbar => {
        panelbar. Add(). Text("My Teammates")
            . Expanded(true)
            . Content(@<div style="padding: 10px;">
            @if (true == true)
                        {
                <div class="teamMate">
                    <img src="@Url.Content("~/shared/web/panelbar/andrew.jpg")" alt="Andrew Fuller">
                    <h2>Andrew Fuller</h2>
                    <p>Team Lead</p>
                </div>
                <div class="teamMate">
                    <img src="@Url.Content("~/shared/web/panelbar/nancy.jpg")" alt="Nancy Leverling">
                    <h2>Nancy Leverling</h2>
                    <p>Sales Associate</p>
                </div>
                <div class="teamMate">
                    <img src="@Url.Content("~/shared/web/panelbar/robert.jpg")" alt="Robert King">
                    <h2>Robert King</h2>
                    <p>Business System Analyst</p>
                </div>
                        }
            /**/
        </div>);

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/640604/format-document-adding-empty-comments-in-cshtml-fi.html
VSTS ticketId: 945043

These are the original issue comments:

Visual Studio Feedback System on 7/10/2019, 09:28 PM (21 days ago):

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.



Visual Studio Feedback System on 7/11/2019, 11:27 PM (20 days ago):

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2017#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.



Ailsa Gu [MSFT] on 7/28/2019, 11:23 PM (3 days ago):

This feedback is being re-triaged as we are moving it to another team that can better help with the issue. Thanks for your patience.



These are the original issue solutions:
(no solutions)

@vatsalyaagrawal vatsalyaagrawal added Area-IDE Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-Formatter Code formatter and/or smart indent labels Aug 1, 2019
@vatsalyaagrawal vatsalyaagrawal added this to the Backlog milestone Aug 1, 2019
@RikkiGibson
Copy link
Contributor

I ran the contents of the code blocks through an XML unescaper to make it easier to read.

@RemiBou
Copy link

RemiBou commented Sep 10, 2019

Go the same problem with .razor file on the latest preview, here are some repro steps

git clone https://github.com/RemiBou/protobuf-net.git
git checkout protobufgen-blazor
open src/protogen.site.blazor.client/Pages/Index.razor
Ctrl K+D => a comment will appear line 73 (like all the other comment already there)

@sharwell sharwell added the Developer Community The issue was originally reported on https://developercommunity.visualstudio.com label Nov 21, 2019
@MylesRip
Copy link

For what it's worth, this is still happening in .razor files using VS Pro 2019 v. 16.3.9.

@tlemmons
Copy link

Has anyone found a work around for this. My files just get longer and longer with all these empty comment lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-Formatter Code formatter and/or smart indent
Projects
None yet
Development

No branches or pull requests

7 participants