Fixes https://github.com/dotnet/razor/issues/10696
Fixes https://github.com/dotnet/razor/issues/10769
Fixes https://github.com/dotnet/razor/issues/10874
Needs Roslyn change: https://github.com/dotnet/roslyn/pull/75102
The actual code change was quite straight foward. The test code was a
bigger pain. Previously in cohosting tests we had two MEF composition,
one for Razor and one for Roslyn. Since Roslyn diagnostics can only run,
or at least start, in devenv, we now need three MEF compositions -
Roslyn devenv, Roslyn OOP and razor OOP - and two workspaces - Roslyn
devenv and Roslyn OOP - and our previous MEF infrastructure really
didn't handle this well, as evidenced by the fact that this PR also
fixes https://github.com/dotnet/razor/issues/10874
Now our MEF infra is simpler: We still cache catalogs etc. statically
the save time, but we create an `ExportProvider` as needed and expect
consumers to dispose of it like any other `IDisposable`, though there is
also here a test fixture to share the editor composition in the
formatting tests so we don't pay a huge penalty in terms of test run
time.
Commit-at-a-time if you want to read the story from beginning to end,
but it should be reasonably okay to just review as a whole too.
From a conversation on Teams. `FormattingContext` is disposable because
it owns a workspace, but it also gets non-destructively mutated so it's
unclear as to whether the disposal was working as intended, and unclear
to consumers what needed to happen. Upon review of the code, this PR:
* Moves workspace ownership to the caller of the formatting code, so its
disposal is clear
* Makes `AdhocWorkspaceFactory` shared code, because it did the same
thing in OOP and LSP server
* Adds `IHostServicesProvider` to OOP, because thats the thing that was
actually different between OOP and LSP server
* Random cleanup of some related things
Altered `HtmlFormattingPassBase` to discard any `TextChange`s that start
within a `RazorCommentBlockSyntax` and added a test to catch any
regressions in the future.
Fixes https://github.com/dotnet/razor/issues/10891
* Fixing WrapWithDive bug
https://github.com/dotnet/razor/issues/10819
* Adding and fixing tests
1. All existing tests were calling Verify on client connection without marking setup Verifyable, so it was a no-op (did nothing)
2. Two tests were erroneously verifying the opposite of what they should've - they were trying to verify that we made a delegated server call when we shouldn't have made one.
I made sure all setups are marked verifyable, and that we verify that calls weren't made when they shouldn't have been made.
Now that razor is on .NET 9 arcade, it can switch over to the new control schema. For this repo, this is roughly:
- DotNetBuildFromSource -> DotNetBuildSourceOnly - Building a source-only build.
- DotnetBuildFromSourceFlavor == Product -> DotNetBuildOrchestrator == true - Building in the VMR, could be source-only or MS's build.
- ArcadeBuildFromSource -> DotNetBuildRepo == true -> Indicates an outer repo build.