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

Implement formatting in the Code Style layer #31276

Merged
merged 17 commits into from
Nov 27, 2018

Conversation

sharwell
Copy link
Member

Fixes #30472

@sharwell sharwell added the PR For Personal Review Only The PR doesn’t require anyone other than the developer to review it. label Nov 20, 2018
@sharwell sharwell requested review from a team as code owners November 20, 2018 02:29
@CyrusNajmabadi
Copy link
Member

The thing that woul dhelp me out the most is understanding the overall long term plan here (and where we are in the middle of it). For example, is this transitionary, with the entirety of the formatting code going to live in the CodeStyle dll? Or is the expectation that we'll have it living to two locations? Is there guidance around how to properly edit/test things so that we can be sure stuff is working properly in both locations?

@sharwell
Copy link
Member Author

The thing that woul dhelp me out the most is understanding the overall long term plan here (and where we are in the middle of it). For example, is this transitionary, with the entirety of the formatting code going to live in the CodeStyle dll? Or is the expectation that we'll have it living to two locations? Is there guidance around how to properly edit/test things so that we can be sure stuff is working properly in both locations?

I don't have good answers here. We're going to have some ugly compat questions to figure out. In the meantime, I've attempted to share as much code as possible.

@sharwell sharwell added Area-IDE and removed PR For Personal Review Only The PR doesn’t require anyone other than the developer to review it. labels Nov 20, 2018
@sharwell sharwell force-pushed the code-style-formatter branch 2 times, most recently from 75c06a3 to c12f9d8 Compare November 22, 2018 05:30
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiler change (in Hash.cs) LGTM. Thanks


namespace Microsoft.CodeAnalysis
{
internal static class AnalyzerConfigOptionsExtensions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AnalyzerConfigOptionsExtensions [](start = 26, length = 31)

I presume this will go away after the compiler's AnalyzerConfigOptions type is available? Do we have more such files that are temporary? If so, might want to file a tracking issue that lists all temporary files to be removed.

{
RangeExpressionSyntax rangeExpression = (RangeExpressionSyntax)previousToken.Parent;
if (rangeExpression.RightOperand != null)
if (previousKind == SyntaxKindEx.DotDotToken && previousParentKind == SyntaxKindEx.RangeExpression)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SyntaxKindEx [](start = 32, length = 12)

Will formatting support for all new language features need to go through this approach now? It might be good to extract out this code into a separate helper/extension so all these are in one place.

@mavasani
Copy link
Contributor

internal class EditorConfigOptionsApplier

Ah, I was hoping this type went away, but I guess you can't get rid of this until you move to compiler's AnalyzerConfigOptions?


Refers to: src/Tools/dotnet-format/EditorConfigOptionsApplier.cs:13 in c74f16a. [](commit_id = c74f16a, deletion_comment = False)

Copy link
Contributor

@mavasani mavasani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Eager to see your next refactoring when you move to AnalyzerConfigOptions and clean this up further.

@CyrusNajmabadi
Copy link
Member

Yup! This is great. And i'm very sympathetic to the difficulties faced here moving/sharing things here. One thing that woudl be helpful to me might be a high level list of steps you think we need to take for the short/medium/long terms to get to where we'd want. Primarily this would help in terms of shutting me up in PRs with my voicing of some concerns. Basically, since i don't know what's coming up in the future, i'm often more critical of things i see since i assume tehy'll be the final state of the code. If i know it's a stepping stone to break things up, and later changes will clean things up, i know i can hold off on that feedback since it's been covered as part of the transition plan.

@sharwell sharwell merged commit d025402 into dotnet:master Nov 27, 2018
@sharwell sharwell deleted the code-style-formatter branch November 27, 2018 22:23
sharwell added a commit to sharwell/roslyn that referenced this pull request Nov 27, 2018
Reverts the changes to Hash.cs from dotnet#31276 and unlinks the file from the
Code Style layer.
@sharwell sharwell added this to the 16.0.P2 milestone Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants