-
Notifications
You must be signed in to change notification settings - Fork 196
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
Fix FormattingContext
disposal
#10887
Conversation
And remove the Uri property as it was almost entirely unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, my only thought is - do we still need the Provider if there is 1:1 mapping between them? Is there a lot of value in lazily creating the workspace via the provider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clean up! The disposal and ownership of the workspace is much cleaner, though I think the IDisposable
contract in AdhocWorkspaceProvider
can be tightened up a bit more.
src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteHostServicesProvider.cs
Outdated
Show resolved
Hide resolved
...AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs
Outdated
Show resolved
Hide resolved
...NetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocWorkspaceProvider.cs
Outdated
Show resolved
Hide resolved
Right now all of our tests pass if we don't use any of the host services provider stuff, and if VA Code formatting works then I don't know why we couldn't just have the code be |
… to a single formatting operation
Thank you for the excellent PR feedback! I have moved the workspace and document creation down even lower, so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! I'm not sad to see IAdhocWorkspaceFactory
removed. 😄
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:AdhocWorkspaceFactory
shared code, because it did the same thing in OOP and LSP serverIHostServicesProvider
to OOP, because thats the thing that was actually different between OOP and LSP server