Repository navigation
Fix reading indent style and indent size from VS settings #65382
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,8 +78,9 @@ public Provider() | |
| new(FeatureName, FormattingOptionGroups.NewLine, nameof(InsertFinalNewLine), DocumentFormattingOptions.Default.InsertFinalNewLine, | ||
| storageLocation: EditorConfigStorageLocation.ForBoolOption("insert_final_newline")); | ||
|
|
||
| public static PerLanguageOption2<FormattingOptions2.IndentStyle> SmartIndent { get; } = | ||
| new(FeatureName, FormattingOptionGroups.IndentationAndSpacing, nameof(SmartIndent), defaultValue: IndentationOptions.DefaultIndentStyle); | ||
| public static PerLanguageOption2<IndentStyle> SmartIndent { get; } = | ||
| new(FeatureName, FormattingOptionGroups.IndentationAndSpacing, nameof(SmartIndent), defaultValue: IndentationOptions.DefaultIndentStyle, | ||
| new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Indent Style")); | ||
|
Comment on lines
+81
to
+83
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand how roaming storage location is useful here? So its value will always remain Anything I'm missing? I'm curious to know the user-visible effect of this change if you noticed any.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The option is read from global options here: https://sourceroslyn.io/#Microsoft.CodeAnalysis.LanguageServer.Protocol/Features/Options/IndentationOptionsStorage.cs,21 Global options end up calling The option is owned by the VS platform, not Roslyn. Roslyn does not set it nor has any UI that exposes it. It just needs to read it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @tmat @arkalyanms for clarifying. |
||
|
|
||
| #if !CODE_STYLE | ||
| internal static readonly ImmutableArray<IOption> Options = ImmutableArray.Create<IOption>( | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
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.
Should we instead update the following line to match the type stored in
_settingsManager?roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs
Line 55 in f814f00
Edit: This change might not be necessary with the suggestion in #65382 (review)
Uh oh!
There was an error while loading. Please reload this page.
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.
I don't think so. The fact that the option is stored as Int64 in VS setting is a VS-specific quirk. Quite odd, since there is no reason for it to be 64 bit.
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.
@tmat Then what about the more generalized approach suggested in #65382 (review)?
This will ensure that no such issues exist whatever the type of option is.
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.
Will follow up on that later on: #65394