-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
src/CodeStyle/CSharp/Analyzers/Formatting/Engine/CSharpFormatEngine.cs
Outdated
Show resolved
Hide resolved
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? |
src/CodeStyle/CSharp/Analyzers/Formatting/CSharpFormattingOptions.cs
Outdated
Show resolved
Hide resolved
src/CodeStyle/CSharp/Analyzers/Formatting/CSharpSyntaxFormattingService.cs
Outdated
Show resolved
Hide resolved
src/CodeStyle/CSharp/Analyzers/Formatting/MemberDeclarationSyntaxExtensions.cs
Outdated
Show resolved
Hide resolved
src/CodeStyle/CSharp/Analyzers/Formatting/SyntaxNodeExtensions.cs
Outdated
Show resolved
Hide resolved
src/CodeStyle/CSharp/Analyzers/Formatting/SyntaxTokenExtensions.cs
Outdated
Show resolved
Hide resolved
src/CodeStyle/Core/Analyzers/Formatting/AbstractSyntaxFormattingService.cs
Outdated
Show resolved
Hide resolved
src/CodeStyle/Core/Analyzers/Formatting/SourceTextExtensions.cs
Outdated
Show resolved
Hide resolved
src/CodeStyle/VisualBasic/Analyzers/Formatting/SyntaxTreeExtensions.vb
Outdated
Show resolved
Hide resolved
src/CodeStyle/VisualBasic/Analyzers/Formatting/SyntaxTokenExtensions.vb
Outdated
Show resolved
Hide resolved
src/CodeStyle/VisualBasic/Analyzers/Formatting/SyntaxTriviaExtensions.vb
Outdated
Show resolved
Hide resolved
src/Workspaces/VisualBasic/Portable/Formatting/Rules/AdjustSpaceFormattingRule.vb
Show resolved
Hide resolved
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. |
22e4c78
to
e0764df
Compare
src/Workspaces/VisualBasic/Portable/Formatting/Rules/StructuredTriviaFormattingRule.vb
Outdated
Show resolved
Hide resolved
75c06a3
to
c12f9d8
Compare
59b2e2b
to
58e94d2
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
src/Workspaces/CSharp/Portable/Formatting/CSharpSyntaxFormattingService.cs
Show resolved
Hide resolved
{ | ||
RangeExpressionSyntax rangeExpression = (RangeExpressionSyntax)previousToken.Parent; | ||
if (rangeExpression.RightOperand != null) | ||
if (previousKind == SyntaxKindEx.DotDotToken && previousParentKind == SyntaxKindEx.RangeExpression) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
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. |
Reverts the changes to Hash.cs from dotnet#31276 and unlinks the file from the Code Style layer.
Fixes #30472