Skip to content

Allow Razor cohosting to hook into configuration change notifications #78364

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

davidwengier
Copy link
Member

Since Roslyn uses dynamic registration for configuration change requests, Razor can't. Even if we could, as a document-less request, it couldn't be routed to us anyway. So this exposes a hook for us through our EA.

Razor side is at dotnet/razor#11800

Part of dotnet/razor#11759

@davidwengier davidwengier requested a review from a team as a code owner April 29, 2025 05:15
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 29, 2025
{
public ILspService CreateILspService(LspServices lspServices, WellKnownLspServerKinds serverKind)
{
return new RazorConfigurationChangedService(cohostConfigurationChangedService);
Copy link
Member

Choose a reason for hiding this comment

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

You might be teaching me something here. When exporting via the factory, does the service get registered for each of the interfaces that it implements? Or does something else tie this to IOnConfigurationChanged?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but its not specific to factories. The magic is here I believe:

InterfaceNames = Array.ConvertAll(serviceType.GetInterfaces(), t => t.AssemblyQualifiedName!);
(and then
if (lazyService.Metadata.InterfaceNames.Contains(typeof(T).AssemblyQualifiedName!))
when they are retreived)

…ionChangedServiceFactory.cs

Co-authored-by: David Barbet <[email protected]>
@davidwengier davidwengier merged commit 15ec676 into dotnet:main Apr 30, 2025
25 checks passed
@davidwengier davidwengier deleted the RazorDidChange branch April 30, 2025 04:05
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 30, 2025
davidwengier added a commit to dotnet/razor that referenced this pull request May 2, 2025
#11800)

Part of #11759

This cleans up `IClientSettingsManager` and puts it back to its previous
state, removing `IClientSettingsReader` at the same time, and also
implements a hook for VS Code to get notified when the VS Code
configuration changes, and to read the settings as appropriate.

Needs a bump to dotnet/roslyn#78364 before it
will build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants