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

[Feature Request] Code style rule to allow dedented comments #50631

Open
lonix1 opened this issue Jan 20, 2021 · 0 comments
Open

[Feature Request] Code style rule to allow dedented comments #50631

lonix1 opened this issue Jan 20, 2021 · 0 comments
Labels
Area-IDE Feature Request IDE-Formatter Code formatter and/or smart indent
Milestone

Comments

@lonix1
Copy link

lonix1 commented Jan 20, 2021

Brief description:

Please allow us to use dedented comments, without triggering IDE0055. This should be a new formatting rule.

Languages applicable:

c#

Code example that the analyzer should report:

This is currently allowed:

  if (true) {
    fooBar();
    doSomething();
    //andDoAnotherThing();
    alsoThisStuff();
  }

But this fails due to IDE0055 ("Fix formatting"):

  if (true) {
    fooBar();
    doSomething();
  //andDoAnotherThing();     <-- dedent causes an error
    alsoThisStuff();
  }

Additional information:

This sort of commenting is quite common in various codebases, and other frameworks. Why it's desirable:

  • it's MUCH neater when quickly scanning through the code - all the code is "in the right place", without being shifted to the right; also the IDE colors the comments (typically green) to make it easy to differentiate
  • it plays nicely with source control: commenting / uncommenting code doesn't result in ugly diffs - so we can scan through more code more quickly

Please give us an option to allow this?

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 20, 2021
@jinujoseph jinujoseph added Feature Request 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 29, 2021
@jinujoseph jinujoseph added this to the Backlog milestone Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request IDE-Formatter Code formatter and/or smart indent
Projects
None yet
Development

No branches or pull requests

2 participants