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

Lambda expressions with attributes are formatted incorrectly #56543

Closed
PathogenDavid opened this issue Sep 20, 2021 · 2 comments · Fixed by #56639
Closed

Lambda expressions with attributes are formatted incorrectly #56543

PathogenDavid opened this issue Sep 20, 2021 · 2 comments · Fixed by #56639
Assignees
Labels
Area-IDE Bug Feature - Lambda Improvements 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

@PathogenDavid
Copy link
Contributor

PathogenDavid commented Sep 20, 2021

Version Used: Visual Studio 2022 Preview 4, Compiler version: '4.0.0-4.21458.2 (2bfff7b)'. Language version: 10.0.

Steps to Reproduce:

  1. In a new .NET 6 console project, populate Program.cs with the following:
var a = [A] short () => 100;
var b = [A] () => 100;
var c = short () => 100;

public sealed class AAttribute : Attribute { }
  1. Format the document using Edit -> Advanced -> Format Document or run Code Cleanup

Expected Behavior:

No changes, the code is well-formatted.

Actual Behavior:

The space between the assignment operator and the attribute is removed:

var a =[A] short () => 100;
var b =[A] () => 100;
var c = short () => 100;

public sealed class AAttribute : Attribute { }

As far as I know there is not an editorconfig setting for the spaces around the assignment operator, but to remove any doubt I also reproduced this with with Roslyn's .editorconfig.

Relates to test plan #52192

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 20, 2021
@sharwell sharwell added 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 Feature - Lambda Improvements untriaged Issues and PRs which have not yet been triaged by a lead and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 20, 2021
@jcouv jcouv self-assigned this Sep 21, 2021
@jcouv jcouv added this to the 17.0 milestone Sep 21, 2021
@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label Sep 21, 2021
@jcouv jcouv added the 4 - In Review A fix for the issue is submitted for review. label Sep 23, 2021
@jcouv jcouv modified the milestones: 17.0, 17.1 Oct 1, 2021
@jcouv jcouv removed the 4 - In Review A fix for the issue is submitted for review. label Oct 5, 2021
@jcouv
Copy link
Member

jcouv commented Oct 5, 2021

Fix merged for 17.1

@PathogenDavid
Copy link
Contributor Author

Thanks, @jcouv!

@jcouv jcouv moved this to Active/Investigating in Compiler: Julien's umbrellas Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Feature - Lambda Improvements 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
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants