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

Address param-nullchecking formatting issues #58950

Closed
RikkiGibson opened this issue Jan 19, 2022 · 1 comment
Closed

Address param-nullchecking formatting issues #58950

RikkiGibson opened this issue Jan 19, 2022 · 1 comment
Labels
Area-Compilers Area-IDE Feature - Param Null Checking 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

@RikkiGibson
Copy link
Contributor

We have such a test for the formatter itself. It wouldn't hurt to have it for the formatting analyzer too.

[Fact]
[Trait(Traits.Feature, Traits.Features.Formatting)]
public async Task SpacingInNullCheckedParameter()
{
var code =
@"class C
{
static object F(string s !!)
{
}
}";
var expectedCode =
@"class C
{
static object F(string s!!)
{
}
}";
await AssertFormatAsync(expectedCode, code);
}

I did find that we don't do the right thing in the following scenario:

static void M1(string x
    !!)
{
}

I expected !! to always be moved to be right up against the parameter name. It seems like the leading trivia owned by !! should be moved to the next token, for consistency with the following (which doesn't prompt any formatting errors)

static void M1(string x
    )
{
}

All that said, I'd prefer to back-burner this work and possibly make it "help wanted". The important thing I wanted to confirm with this PR is that "correctly formatted" code using the feature doesn't produce formatting warnings.

Originally posted by @RikkiGibson in #58936 (comment)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 19, 2022
@RikkiGibson RikkiGibson added Area-IDE Feature - Param Null Checking 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 and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 19, 2022
@RikkiGibson RikkiGibson added this to the Backlog milestone Jan 19, 2022
@jcouv
Copy link
Member

jcouv commented May 14, 2022

Closing as the feature is no longer applicable.

@jcouv jcouv closed this as completed May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Area-IDE Feature - Param Null Checking 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

2 participants