Honour users' settings as a starting point for Razor formatting#76066
Conversation
d066a2c to
e2ba725
Compare
|
@davidwengier I'm confused. The linked issues repro in VS, but the PR is changing O# ExternalAccess. |
|
The change to O# is just to satisfy the interface change. |
| private static SyntaxFormattingOptions GetFormattingOptions(SolutionServices services, RazorIndentationOptions indentationOptions) | ||
| { | ||
| var legacyOptionsService = services.GetService<ILegacyGlobalOptionsWorkspaceService>(); | ||
| var formattingOptions = legacyOptionsService is null |
There was a problem hiding this comment.
this doesn't run OOP right? IIRC the legacy options service isn't available there
There was a problem hiding this comment.
Either way this won't work in cohosting. Options are not synced pro-actively to Roslyn OOP, each feature pulls what it needs via callbacks, so even if this service is available the underlying IGlobalOptionsService has only defaults in OOP. Callbacks didn't work for Razor services last time I tried (strange IVT-type issues with service hub assembly loading) so this will have to be solved separately.
Sadly cohosting makes some things worse, then we have to go and make them better again.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
In dotnet/razor#6166 we changed Razor to pass indentation options into a Roslyn service, rather than create a workspace and apply changes to it, etc. Sadly this regressed C# formatting in Razor files, because the code was just creating a new
CSharpSyntaxFormattingOptionsand not starting from the users settings.Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2305075
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2305404