Skip to content

Conversation

@davidwengier
Copy link
Member

Fixes #11941

This change means that if cohosting is on, we'll always use LSP, except for .NET Framework projects which will fall back to the really really legacy legacy editor. That editor has no interaction with any of our code, except the VS editor does send us a couple of LSP methods (because dynamic registration is by file extension, not content type) so we have to be a tiny bit defensive.

@davidwengier davidwengier requested a review from a team as a code owner June 18, 2025 05:07
{
// The editor can send us a document symbol request in a .NET Framework project for some reason, so we have to be
// a little defensive here.
if (context.TextDocument is null)
Copy link
Member Author

Choose a reason for hiding this comment

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

I was tempted to put this null check in Roslyn, or a base class in this repo, but it seems like there are only two endpoints that need it (for .NET Framework projects at least) so I'll leave that for #11942 when I tackle incompatible .NET Core projects

_lspEditorFeatureDetector.IsDotNetCoreProject(filePath))
{
contentType = _contentTypeRegistryService.GetContentType(RazorConstants.RazorLSPContentTypeName);
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: understanding it's trivial, stills seems a bit funky to have two separate ifs next to each other with the same exact body. not asking to change necessarily, just wanted to mention it was the only thing i had to look at twice - "are they both doing them same thing? next to each other?" (obviously for different conditions)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point, I'll extract some things to methods

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes it easier to read IMHO, thank you!

Copy link
Contributor

@alexgav alexgav left a comment

Choose a reason for hiding this comment

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

:shipit:

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.

Review cohosting and legacy editor

4 participants