Skip to content

Conversation

@davidwengier
Copy link
Member

In VS Code, Razor cohosting logs to the Razor Log output category as you would expect, but all of the CLaSP logging ends up in the C# output, including all of the MEF composition and ALC processing stuff, which is relatively noisy. This fixes that by remapping logs to the Razor log endpoint for contexts that specify the Razor language, and makes requests for Razor specify that context.

This is a bit of speculative work on a Sunday, so feel free to reject or suggest a different API. I don't really love having a separate method for this, but having one method with two parameters would mean nobody ever passes in both parameters.

The results at runtime in VS Code are huge though, and will make investigating issues easier for us and you.

Part of dotnet/razor#11759

@davidwengier davidwengier requested a review from dibarbet April 27, 2025 01:51
@davidwengier davidwengier requested a review from a team as a code owner April 27, 2025 01:51
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 27, 2025
@davidwengier
Copy link
Member Author

I guess the other option here would be to use a custom Roslyn log message handler that passed along language info, and do the redirection there, but I think the ILspLogger changes would be the same.

Copy link
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

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

this seems fine. an alternative path might be to utilize the same LSP message, but add on an additional language property. Then on the client via a middleware, redirect to the Razor logger.

But I am fine with either approach, I can't think of meaningful differences between them

@davidwengier
Copy link
Member Author

Then on the client via a middleware

Had the same thought, but window/log is not middleware-able: microsoft/vscode-languageserver-node#1131

@dibarbet
Copy link
Member

Had the same thought, but window/log is not middleware-able: microsoft/vscode-languageserver-node#1131

that makes the choice easy then!

@davidwengier davidwengier merged commit 5631a0e into dotnet:main Apr 28, 2025
25 checks passed
@davidwengier davidwengier deleted the RedirectRazorLogs branch April 28, 2025 21:14
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 28, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
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.

3 participants