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

Use the Roslyn project system for generating code for open documents #9831

Merged
merged 15 commits into from
Jan 26, 2024

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Jan 18, 2024

Part of #9519

Right now code generation, in co-hosting and non, comes from document snapshots in the Razor project system which directly call the Razor compiler. This change means that all Html and C# code generation in co-hosting is done based on the TextDocument, which means it will come from the source generator when that part is ready.

This is the Razor side of, and needs a Roslyn bump to, dotnet/roslyn#71671

@davidwengier davidwengier requested a review from a team as a code owner January 18, 2024 03:20
@@ -20,6 +20,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisWorkspacesCommonPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.NonCapturingTimer.Sources" Version="$(MicrosoftExtensionsNonCapturingTimerSourcesPackageVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="$(MicrosoftVisualStudioLanguageServerProtocolPackageVersion)" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This used to come in as a transitive dependency from Roslyn I suppose, but they no longer reference it.

Copy link
Member

@DustinCampbell DustinCampbell Jan 18, 2024

Choose a reason for hiding this comment

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

This used to come in as a transitive dependency from Roslyn I suppose, but they no longer reference it.

Yeah, that makes sense.

Copy link
Member

@DustinCampbell DustinCampbell left a comment

Choose a reason for hiding this comment

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

Looks great to me, once the Roslyn version is bumped.

@@ -20,6 +20,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisWorkspacesCommonPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.NonCapturingTimer.Sources" Version="$(MicrosoftExtensionsNonCapturingTimerSourcesPackageVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="$(MicrosoftVisualStudioLanguageServerProtocolPackageVersion)" />
Copy link
Member

@DustinCampbell DustinCampbell Jan 18, 2024

Choose a reason for hiding this comment

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

This used to come in as a transitive dependency from Roslyn I suppose, but they no longer reference it.

Yeah, that makes sense.

@davidwengier
Copy link
Contributor Author

once the Roslyn version is bumped

I lucked into picking up a bunch of breaking changes in CLaSP with the update, so it is taking a little longer than I'd have hoped. Will probably ask for a re-review when its done, just as a sanity check :)

@davidwengier davidwengier requested a review from a team as a code owner January 19, 2024 00:52
@davidwengier
Copy link
Contributor Author

Apologies folks, but this PR just got a lot bigger, so @ryzngard and @DustinCampbell please have another look over the most recent commits. There were a bunch of changes in CLaSP that had to be responded to, as well as Roslyn moving to their own protocol types for LSP which broke a bunch of tests, and only has a hacky fix for now.

Note that the Roslyn version being referenced here is probably not the final one, if we want to match what goes into VS, that depends on which insertion PR actually gets in to VS, and at the moment I can't really merge this, as our integration tests will fail until the Roslyn insertion is merged, and available in a build.

@davidwengier
Copy link
Contributor Author

davidwengier commented Jan 19, 2024

Well those builds failed a lot quicker than I though, and the build doesn't fail locally 🤦‍♂️ A bit of nuget.config twiddling and I think we're good.

Copy link
Member

@DustinCampbell DustinCampbell left a comment

Choose a reason for hiding this comment

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

Still looking good to me.

@davidwengier
Copy link
Contributor Author

CLaSP changes are being reverted in dotnet/roslyn#71726. Looks like this PR will be a gift that keeps on giving :)

@davidwengier davidwengier force-pushed the GenerationFromTextDocument branch from 39dc990 to 2efe53c Compare January 22, 2024 20:48
@davidwengier davidwengier merged commit 46a1c23 into dotnet:main Jan 26, 2024
12 checks passed
@davidwengier davidwengier deleted the GenerationFromTextDocument branch January 26, 2024 11:03
@ghost ghost added this to the Next milestone Jan 26, 2024
@Cosifne Cosifne modified the milestones: Next, 17.10 P1 Jan 30, 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.

4 participants