Skip to content

Conversation

@mavasani
Copy link
Contributor

@mavasani mavasani commented Feb 8, 2020

…jects

Extracts out the changes to core Workspace layer from #41363.

Changes that were undone from #41363 for easier review:

  1. Shared projects for analyzer, code fixes and unit tests
  2. Porting of IDE analyzers, code fixes and unit tests to CodeStyle layer
  3. All the changes related to Options
  4. All the test framework changes
  5. Most of the changes in CodeStyle layer.
  6. Changes to most of the resource files. I still had to retain changes add some resources in CodeStyle layers. You can exclude these resx and xlf files from your review by using GitHub's file filter: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/filtering-files-in-a-pull-request

…jects

Extracts out the changes to core Workspace changes from dotnet#41363.
@mavasani
Copy link
Contributor Author

mavasani commented Feb 8, 2020

@CyrusNajmabadi I believe this PR should be much easier to review. Even though large number of files are touched, most of them are moves or file splits. Breaking it down further is just too much pain and needs almost to redo the entire work step by step from scratch, which is not worth.

}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

skipping this file. i will leave to mef people to look at :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is most likely a temporary approach for discovering language services in CodeStyle layer. #41462 tracks removal of MEF, and likely would need @jasonmalinowski or @sharwell to figure out a good non-MEF based solution to implement it.

@CyrusNajmabadi
Copy link
Member

Will try to review this tonight (unless you'd like me to hold off). LMK what your pref is.

<InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Compilers\Core\Portable\InternalUtilities\Debug.cs" Link="Formatting\Debug.cs" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All these linked files moved into shared project now.

<Compile Include="..\..\..\Workspaces\Core\Portable\Shared\Collections\IIntervalIntrospector.cs" Link="Formatting\Context\IIntervalIntrospector.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Shared\Collections\IntervalTree`1.cs" Link="Formatting\Context\IntervalTree`1.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Shared\Collections\IntervalTree`1.Node.cs" Link="Formatting\Context\IntervalTree`1.Node.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Shared\Collections\SimpleIntervalTree.cs" Link="Formatting\SimpleIntervalTree.cs" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is scope to move more utilities down to the shared layer in future.


var solution = await fixAllService.GetFixAllChangedSolutionAsync(
fixCollection.FixAllState.CreateFixAllContext(progressTracker, cancellationToken)).ConfigureAwait(false);
new FixAllContext(fixCollection.FixAllState, progressTracker, cancellationToken)).ConfigureAwait(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CreateFixAllContext was inlined here as the FixAllState.cs has been moved to the shared layer, but creating a new FixAllContext is only required from IDE code fix service engine and test layer.

Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions
Partial Friend Module SemanticModelExtensions

Private Const s_defaultParameterName = "p"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All existing code that was just moved as is.

End Get
End Property

Public Overrides Async Function RemoveUnnecessaryImportsAsync(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Existing code that was just moved.

Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification
Friend Module VisualBasicSimplificationHelpers
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Existing code extracted out into a shared module.

Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions
Partial Friend Module SyntaxNodeExtensions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved into shared layer in existing extension method file

@@ -61,29 +61,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification
End Using
End Function

Public Shared Function TryEscapeIdentifierToken(identifierToken As SyntaxToken) As SyntaxToken
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved into extension method file.

@mavasani
Copy link
Contributor Author

Will try to review this tonight (unless you'd like me to hold off). LMK what your pref is.

Thanks, that would be great! I will try my best to see what all pieces can be threaded out. Hoping that once this PR merged in, it allows further refactoring like your PRs to move further code down and reduces chances of merge conflicts.

@mavasani mavasani marked this pull request as ready for review February 11, 2020 00:50
@mavasani mavasani requested review from a team as code owners February 11, 2020 00:50
}

#if WORKSPACE
#if CODE_STYLE
Copy link
Contributor Author

@mavasani mavasani Feb 11, 2020

Choose a reason for hiding this comment

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

@dotnet/roslyn-compiler The only changes to compiler layer are in 3 files: this one and the 2 that follow. The changes are just adding a new #if CODE_STYLE for these utility types that are now also included in the CodeStyle layer.

Copy link
Member

@jaredpar jaredpar left a comment

Choose a reason for hiding this comment

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

:shipit:

@jaredpar
Copy link
Member

Approved the three changes to the Compiler layer

Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

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

Assuming this is just a subset of he original PR, which LGTM.

@mavasani
Copy link
Contributor Author

Assuming this is just a subset of he original PR, which LGTM.

Yes, it just extracts out the Workspace related pieces from that PR.

Protected Overrides Function MergeImports(unnecessaryImports As ImmutableArray(Of SyntaxNode)) As ImmutableArray(Of SyntaxNode)
Dim result = ArrayBuilder(Of SyntaxNode).GetInstance()
Dim importsClauses = unnecessaryImports.CastArray(Of ImportsClauseSyntax)
Dim importsClauses = unnecessaryImports.ToImmutableHashSet()
Copy link
Member

Choose a reason for hiding this comment

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

undo if not necessary.

@CyrusNajmabadi
Copy link
Member

So overall i skimmed. files that were pure-add/pure-delete were skipped as i assume those represent the extension-method moves. I'm a littel wary of how much i had to skip as there might have been relevant code in there tat i just didn't see.

However, overall, this seems like a very safe, very reasonable change to make. i highly doubt anything bad is sneaking in. And, if there is any issues hwere, i think we're likely to discover it immediately.

I would ask that we file some issues to ensure proper cleanup happens in future PRs coming in the next couple of weeks. Also, i left a few final comments on things we might want to look into in this PR.

Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

Overall this is good enough that i feel ok taking as is.

My personal feedback though is that in the future we should try harder up front to break up these changes into more manageable pieces. There are still several changes here that i think would have been better to break out just to build confidence and assurance that the big changes weren't potentially doing anything that required review with a fine-toothed comb.

Thanks!

@mavasani mavasani mentioned this pull request Feb 11, 2020
23 tasks
@mavasani
Copy link
Contributor Author

Sync'ed with @sharwell offline, and he is fine with going ahead with this merge. Lets get to the follow-up items soon.

@mavasani mavasani merged commit 2b12b9f into dotnet:master Feb 11, 2020
@mavasani mavasani deleted the WorkspaceRefactoring branch February 11, 2020 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants