Skip to content

Visual studio 2022 community code cleanup in razor files #10931

Open
@vsfeedback

Description

@vsfeedback

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


[severity:It bothers me. A fix would be nice]
I have issues with the visual studio 2022 analyze > code cleanup functionnality. It's working fine in regular C#. My code formats correctly based on my preferences defined in the editorconfig file and the visual studio config. But when using the ctrl k + ctrl d command from within a razor file, the C# code inside a @{ } block is acting weird.
When writing a statement on multiple lines, it removes spaces to make all lines start at the same indent level.

Here are the two codess : The first one is the correctly formatted code inside a regular C# file, the second one is the code inside a code block in a razor file.

First :

IFormGroup? linkedProduct =
        identificationGroups
          . FirstOrDefault( group =>
            group
              . FormItemsCollection
              . OfType<IFormItem>( )
              . Any( item =>
                item
                  . Field == nameof( StockItemDetailDTO.LinkedProduct.Id )
              )
          );

Second :

var linkedProduct =
    identificationGroups
    . FirstOrDefault(group =>
    group
    . FormItemsCollection
    . OfType<IFormItem>()
    . Any(item =>
    item
    . Field == nameof(StockItemDetailDTO.LinkedProduct.Id)
    )
    );

Can you provide me help ?


Original Comments

Feedback Bot on 9/17/2024, 06:30 PM:

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions