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

Replace ISolutionQueryOperations in hover with a dedicated service #11374

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

DustinCampbell
Copy link
Member

When determining what projects a component or tag helper is available within, there is slightly different behavior in the Razor language server vs. co-hosting. In the language server, there is a special case to skip the misc-files project, but that case isn't bothered with in co-hosting. The special case is manifested via different implementations of ISolutionQueryOperations.GetProjectsContainingDocument(...) in the language server and co-hosting.

This change (which is largely mechanical) introduces a new service, IComponentAvailabilityService, that is used to determine what projects a component or tag helper is available within. The intention is that this service contains the behavior difference between the language server and co-hosting rather than relying on ISolutionQueryOperations, which will be going away with proper Razor solution snapshots.

When determining what projects a component or tag helper is available within, there is slightly different behavior in the Razor language server vs. co-hosting. In the language server, there is a special case to skip the misc files project which isn't bothered with in co-hosting. The special case is manifested via the different implementations of ISolutionQueryOperations.GetProjectsContainingDocument.

This change introduces a new service, IComponentAvailabilityService, that is used to determine what projects a component or tag helper is available within. The intention is that this service contains the behavior difference between the language server and co-hosting rather than relying on ISolutionQueryOperations, which will be going away with proper Razor solution snapshots.
@DustinCampbell DustinCampbell requested a review from a team as a code owner January 9, 2025 17:21
Copy link
Contributor

@ryzngard ryzngard left a comment

Choose a reason for hiding this comment

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

Overall looks good. Some nits about location/namespacing that I don't think make sense after this change.

Copy link
Contributor

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

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

Is the plan that there will be some kind of ISolutionSnapshot available in cohosting and non, and when that happens the GetComponentAvailability method will get one of them as a parameter?

I can't imagine it working any other way (unless you're planning on introducing a "CurrentSolution" concept in cohosting, but that would be more surprising)

@DustinCampbell
Copy link
Member Author

Is the plan that there will be some kind of ISolutionSnapshot available in cohosting and non, and when that happens the GetComponentAvailability method will get one of them as a parameter?

I can't imagine it working any other way (unless you're planning on introducing a "CurrentSolution" concept in cohosting, but that would be more surprising)

Yes, I was thinking that GetComponentAvailability would be passed an ISolutionSnapshot as the scope to search.

unless you're planning on introducing a "CurrentSolution" concept in cohosting, but that would be more surprising

I agree that would be surprising and I don't intend on doing that.

@DustinCampbell DustinCampbell merged commit 03741ba into dotnet:main Jan 9, 2025
17 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 9, 2025
@davidwengier
Copy link
Contributor

Yes, I was thinking that GetComponentAvailability would be passed an ISolutionSnapshot as the scope to search.

Awesome! I was going to suggest that could be done now by passing an ISolutionQueryOperations, and then later the param type could just be updated, but that would at least let the service be MEF exportable in cohosting, but I then figured since you'd already written the code it probably didn't matter much :)

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