Add three new options for collapsing/outlining on file open#60743
Add three new options for collapsing/outlining on file open#60743davidwengier merged 14 commits intodotnet:mainfrom
Conversation
| bannerText: GetBannerText(regionDirective), | ||
| autoCollapse: autoCollapse, | ||
| isDefaultCollapsed: !options.IsMetadataAsSource)); | ||
| isDefaultCollapsed: options.CollapseRegionsOnFileOpen)); |
There was a problem hiding this comment.
This is where the "Enter outlining mode" was equivalent to "Collapse regions on file open", but has been split to a separate option. The !options.IsMetadataAsSource wasn't doing anything here (it may as well have been true) because the code path for metadata as source uses the autoCollapse property which has the real logic (a few lines up from what GitHub shows here)
|
|
||
| if (!workspace.Options.GetOption(FeatureOnOffOptions.Outlining, this.RoslynLanguageName)) | ||
| { | ||
| outliningManager.Enabled = false; |
There was a problem hiding this comment.
This is where the old "Enter outlining mode" would actually turn off outlining.
The diff for this file is probably best viewed with whitespace off.
| <value>Prefer simplified object creation</value> | ||
| </data> | ||
| <data name="Collapse_imports_on_file_open" xml:space="preserve"> | ||
| <value>Collapse Imports on file open</value> |
There was a problem hiding this comment.
See Mum, I remembered!!
src/Features/CSharp/Portable/Structure/Providers/CompilationUnitStructureProvider.cs
Outdated
Show resolved
Hide resolved
...tures/CSharp/Portable/Structure/Providers/FileScopedNamespaceDeclarationStructureProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/Structure/Providers/NamespaceDeclarationStructureProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/Features/Options/BlockStructureOptionsStorage.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
| bool ShowOutliningForDeclarationLevelConstructs = true, | ||
| bool ShowOutliningForCodeLevelConstructs = true, | ||
| bool CollapseRegionsWhenFirstOpened = true, | ||
| bool CollapseImportsWhenFirstOpened = false, |
There was a problem hiding this comment.
interesting. is that to match VB current bheavior?
There was a problem hiding this comment.
This matches the current VB and C# behaviour. Before this PR we didn't collapse usings, nor have an option for it.
|
Done with pass. |
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest/Structure/RegionDirectiveStructureTests.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/VisualBasicTest/Structure/MetadataAsSource/RegionDirectiveStructureTests.vb
Show resolved
Hide resolved
…ptions # Conflicts: # src/VisualStudio/Core/Def/ServicesVSResources.resx
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
|
Be sure to update the strings used by the Tools>Options search. |
|
May I know is this PR already released in VS 17.3? I upgraded my VS up to date today, but I found the checkbox |
|
If you can see the checkbox, then it's released :) It's worth noting that VS remembers the outlining state for all files so if you change the checkbox you should delete the .suo file, or the .vs directory, and then check what happens when you open a file. Sorry I can't be sure which one, I'm not near a computer right now. If you still have problems with it, please do log an issue with all of the details and I'll take a look. |
|
@davidwengier 👍 It works, great thanks. |
Fixes #60049
Fixes #44843
Options pane looks like this:
