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

Rationalize ProjectSnapshotManager methods #11294

Conversation

DustinCampbell
Copy link
Member

This pull request is an attempt to rationalize and normalize the "Get" methods on IProjectSnapshotManger and IProjectSnapshot. The goal here is to try and match common naming conventions (e.g. GetLoadedProject becomes GetRequiredProejct) and match Roslyn where appropriate. In addition, some methods have been converted to or introduced as extension methods. This allows the interfaces to stay light a bit lighter and exclude members that have the same implementation across the code base. This is especially useful for IProjectSnapshot, which is implemented as ProjectSnapshot and RemoteProjectSnapshot.

Reviewing commit-by-commit might be helpful.

This method just delegates to TryGetDocument, so it can be converted to an extension method.
Most callers of IProjectSnapshot.GetDocument() assume the result is non-null, so IProjectSnapshot.GetRequiredDocument() will verify the result.
This allows checking for the presence of a project without retrieving a snapshot.
This name better matches its Roslyn cousin: GetDocumentIdsWithFilePath.
@DustinCampbell DustinCampbell requested a review from a team as a code owner December 11, 2024 21:16
@DustinCampbell DustinCampbell merged commit 96eab23 into dotnet:main Dec 12, 2024
12 checks passed
@DustinCampbell DustinCampbell deleted the rationalize-projectsnapshotmanager-methods branch December 12, 2024 00:13
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 12, 2024
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.

3 participants