-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Honour users' settings as a starting point for Razor formatting #76066
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't run OOP right? IIRC the legacy options service isn't available there
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.
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
CSharpSyntaxFormattingOptions
and not starting from the users settings.Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2305075
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2305404