Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit47e74f5

Browse files
cartermpKevinRansom
authored andcommitted
Toggles for outlining and structured guidelines (dotnet#4227)
* Toggles for outlining and structured guidelines* Cleanup* Don't remove outlining alongside block structure lines and better names* fix up rebase;
1 parentaee2fa8 commit47e74f5

File tree

38 files changed

+541
-57
lines changed

38 files changed

+541
-57
lines changed

‎vsintegration/src/FSharp.Editor/Common/Constants.fs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
namespaceMicrosoft.VisualStudio.FSharp.Editor
44

55
openSystem
6-
openSystem.Configuration
7-
openSystem.Diagnostics
8-
openMicrosoft.CodeAnalysis.Classification
96

107
[<RequireQualifiedAccess>]
118
moduleinternalFSharpConstants=
@@ -49,7 +46,6 @@ module internal FSharpProviderConstants =
4946
/// "Session Capturing Quick Info Source Provider"
5047
letSessionCapturingProvider="Session Capturing Quick Info Source Provider"
5148

52-
5349
[<RequireQualifiedAccess>]
5450
moduleinternalGuids=
5551

@@ -73,4 +69,7 @@ module internal Guids =
7369
/// "8FDA964A-263D-4B4E-9560-29897535217C"
7470
letlanguageServicePerformanceOptionPageIdString="8FDA964A-263D-4B4E-9560-29897535217C"
7571

72+
[<Literal>]
73+
letadvancedSettingsPageIdSring="9007718C-357A-4327-A193-AB3EC38D7EE8"
74+
7675
letblueHighContrastThemeId= Guid"{ce94d289-8481-498b-8ca9-9b6191a315b9}"

‎vsintegration/src/FSharp.Editor/FSharp.Editor.resx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,7 @@
204204
<dataname="RenameValueToDoubleUnderscore"xml:space="preserve">
205205
<value>Rename '{0}' to '__'</value>
206206
</data>
207+
<dataname="6012"xml:space="preserve">
208+
<value>Advanced</value>
209+
</data>
207210
</root>

‎vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ open Microsoft.VisualStudio.LanguageServices.ProjectSystem
3434
openMicrosoft.VisualStudio.Shell
3535
openMicrosoft.VisualStudio.Shell.Interop
3636
openMicrosoft.VisualStudio.ComponentModelHost
37+
openMicrosoft.VisualStudio.Text.Outlining
3738

3839
// Exposes FSharpChecker as MEF export
3940
[<Export(typeof<FSharpCheckerProvider>); Composition.Shared>]
@@ -285,6 +286,7 @@ type
285286
[<ProvideLanguageEditorOptionPage(typeof<OptionsUI.QuickInfoOptionPage>,"F#",null,"QuickInfo","6009")>]
286287
[<ProvideLanguageEditorOptionPage(typeof<OptionsUI.CodeFixesOptionPage>,"F#",null,"Code Fixes","6010")>]
287288
[<ProvideLanguageEditorOptionPage(typeof<OptionsUI.LanguageServicePerformanceOptionPage>,"F#",null,"Performance","6011")>]
289+
[<ProvideLanguageEditorOptionPage(typeof<OptionsUI.AdvancedSettingsOptionPage>,"F#",null,"Advanced","6012")>]
288290
[<ProvideFSharpVersionRegistration(FSharpConstants.projectPackageGuidString,"Microsoft Visual F#")>]
289291
[<ProvideLanguageService(languageService= typeof<FSharpLanguageService>,
290292
strLanguageName= FSharpConstants.FSharpLanguageName,
@@ -574,6 +576,12 @@ type
574576

575577
lettextViewAdapter= package.ComponentModel.GetService<IVsEditorAdaptersFactoryService>()
576578

579+
// Toggles outlining (or code folding) based on settings
580+
letoutliningManagerService= this.Package.ComponentModel.GetService<IOutliningManagerService>()
581+
letwpfTextView= this.EditorAdaptersFactoryService.GetWpfTextView(textView)
582+
letoutliningManager= outliningManagerService.GetOutliningManager(wpfTextView)
583+
outliningManager.Enabled<- Settings.Advanced.IsOutliningEnabled
584+
577585
match textView.GetBuffer()with
578586
|(VSConstants.S_OK, textLines)->
579587
letfilename= VsTextLines.GetFilename textLines

‎vsintegration/src/FSharp.Editor/Options/EditorOptions.fs‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ open Microsoft.VisualStudio.FSharp.UIResources
77
openSettingsPersistence
88
openOptionsUIHelpers
99

10-
1110
moduleDefaultTuning=
1211
letSemanticColorizationInitialDelay=0(* milliseconds*)
1312
letUnusedDeclarationsAnalyzerInitialDelay=0(* 1000*)(* milliseconds*)
@@ -42,6 +41,11 @@ type LanguageServicePerformanceOptions =
4241
{ EnableInMemoryCrossProjectReferences:bool
4342
ProjectCheckCacheSize:int}
4443

44+
[<CLIMutable>]
45+
typeAdvancedOptions=
46+
{ IsBlockStructureEnabled:bool
47+
IsOutliningEnabled:bool}
48+
4549
[<Export(typeof<ISettings>)>]
4650
typeinternalSettings[<ImportingConstructor>](store: SettingsStore)=
4751
do// Initialize default settings
@@ -67,12 +71,17 @@ type internal Settings [<ImportingConstructor>](store: SettingsStore) =
6771
{ EnableInMemoryCrossProjectReferences=true
6872
ProjectCheckCacheSize=200}
6973

74+
store.RegisterDefault
75+
{ IsBlockStructureEnabled=true
76+
IsOutliningEnabled=true}
77+
7078
interface ISettings
7179

7280
static memberIntelliSense:IntelliSenseOptions= getSettings()
7381
static memberQuickInfo:QuickInfoOptions= getSettings()
7482
static memberCodeFixes:CodeFixesOptions= getSettings()
7583
static memberLanguageServicePerformance:LanguageServicePerformanceOptions= getSettings()
84+
static memberAdvanced:AdvancedOptions= getSettings()
7685

7786
moduleinternalOptionsUI=
7887

@@ -106,4 +115,10 @@ module internal OptionsUI =
106115
typeinternalLanguageServicePerformanceOptionPage()=
107116
inherit AbstractOptionPage<LanguageServicePerformanceOptions>()
108117
overridethis.CreateView()=
109-
upcast LanguageServicePerformanceOptionControl()
118+
upcast LanguageServicePerformanceOptionControl()
119+
120+
[<Guid(Guids.advancedSettingsPageIdSring)>]
121+
typeinternalAdvancedSettingsOptionPage()=
122+
inherit AbstractOptionPage<AdvancedOptions>()
123+
override__.CreateView()=
124+
upcast AdvancedOptionsControl()

‎vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs‎

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,54 +16,57 @@ open Microsoft.FSharp.Compiler.SourceCodeServices
1616
openMicrosoft.FSharp.Compiler.SourceCodeServices.Structure
1717

1818
moduleinternalBlockStructure=
19-
letscopeToBlockType=function
20-
| Scope.Open-> BlockTypes.Imports
21-
| Scope.Namespace
22-
| Scope.Module-> BlockTypes.Namespace
23-
| Scope.Record
24-
| Scope.Interface
25-
| Scope.TypeExtension
26-
| Scope.RecordDefn
27-
| Scope.CompExpr
28-
| Scope.ObjExpr
29-
| Scope.UnionDefn
30-
| Scope.Attribute
31-
| Scope.Type-> BlockTypes.Type
32-
| Scope.New
33-
| Scope.RecordField
34-
| Scope.Member-> BlockTypes.Member
35-
| Scope.LetOrUse
36-
| Scope.Match
37-
| Scope.MatchClause
38-
| Scope.EnumCase
39-
| Scope.UnionCase
40-
| Scope.MatchLambda
41-
| Scope.ThenInIfThenElse
42-
| Scope.ElseInIfThenElse
43-
| Scope.TryWith
44-
| Scope.TryInTryWith
45-
| Scope.WithInTryWith
46-
| Scope.TryFinally
47-
| Scope.TryInTryFinally
48-
| Scope.FinallyInTryFinally
49-
| Scope.IfThenElse-> BlockTypes.Conditional
50-
| Scope.Tuple
51-
| Scope.ArrayOrList
52-
| Scope.CompExprInternal
53-
| Scope.Quote
54-
| Scope.SpecialFunc
55-
| Scope.Lambda
56-
| Scope.LetOrUseBang
57-
| Scope.Val
58-
| Scope.YieldOrReturn
59-
| Scope.YieldOrReturnBang
60-
| Scope.TryWith-> BlockTypes.Expression
61-
| Scope.Do-> BlockTypes.Statement
62-
| Scope.While
63-
| Scope.For-> BlockTypes.Loop
64-
| Scope.HashDirective-> BlockTypes.PreprocessorRegion
65-
| Scope.Comment
66-
| Scope.XmlDocComment-> BlockTypes.Comment
19+
letscopeToBlockType scope=
20+
ifnot Settings.Advanced.IsBlockStructureEnabledthen BlockTypes.Nonstructural
21+
else
22+
match scopewith
23+
| Scope.Open-> BlockTypes.Imports
24+
| Scope.Namespace
25+
| Scope.Module-> BlockTypes.Namespace
26+
| Scope.Record
27+
| Scope.Interface
28+
| Scope.TypeExtension
29+
| Scope.RecordDefn
30+
| Scope.CompExpr
31+
| Scope.ObjExpr
32+
| Scope.UnionDefn
33+
| Scope.Attribute
34+
| Scope.Type-> BlockTypes.Type
35+
| Scope.New
36+
| Scope.RecordField
37+
| Scope.Member-> BlockTypes.Member
38+
| Scope.LetOrUse
39+
| Scope.Match
40+
| Scope.MatchClause
41+
| Scope.EnumCase
42+
| Scope.UnionCase
43+
| Scope.MatchLambda
44+
| Scope.ThenInIfThenElse
45+
| Scope.ElseInIfThenElse
46+
| Scope.TryWith
47+
| Scope.TryInTryWith
48+
| Scope.WithInTryWith
49+
| Scope.TryFinally
50+
| Scope.TryInTryFinally
51+
| Scope.FinallyInTryFinally
52+
| Scope.IfThenElse-> BlockTypes.Conditional
53+
| Scope.Tuple
54+
| Scope.ArrayOrList
55+
| Scope.CompExprInternal
56+
| Scope.Quote
57+
| Scope.SpecialFunc
58+
| Scope.Lambda
59+
| Scope.LetOrUseBang
60+
| Scope.Val
61+
| Scope.YieldOrReturn
62+
| Scope.YieldOrReturnBang
63+
| Scope.TryWith-> BlockTypes.Expression
64+
| Scope.Do-> BlockTypes.Statement
65+
| Scope.While
66+
| Scope.For-> BlockTypes.Loop
67+
| Scope.HashDirective-> BlockTypes.PreprocessorRegion
68+
| Scope.Comment
69+
| Scope.XmlDocComment-> BlockTypes.Comment
6770

6871
letisAutoCollapsible=function
6972
| Scope.New
@@ -127,7 +130,7 @@ module internal BlockStructure =
127130
lethintSpan= RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, scopeRange.Range)
128131
match textSpan,hintSpanwith
129132
| Some textSpan, Some hintSpan->
130-
letline= sourceText.Lines.GetLineFromPositiontextSpan.Start
133+
letline= sourceText.Lines.GetLineFromPosition textSpan.Start
131134
letbannerText=
132135
match Option.ofNullable(line.Span.Intersection textSpan)with
133136
| Some span-> sourceText.GetSubText(span).ToString()+"..."

‎vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@
147147
<targetstate="translated">Přejmenujte {0} na __.</target>
148148
<note />
149149
</trans-unit>
150+
<trans-unitid="6012">
151+
<source>Advanced</source>
152+
<targetstate="new">Advanced</target>
153+
<note />
154+
</trans-unit>
150155
</body>
151156
</file>
152157
</xliff>

‎vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@
147147
<targetstate="translated">"{0}" in "__" umbenennen</target>
148148
<note />
149149
</trans-unit>
150+
<trans-unitid="6012">
151+
<source>Advanced</source>
152+
<targetstate="new">Advanced</target>
153+
<note />
154+
</trans-unit>
150155
</body>
151156
</file>
152157
</xliff>

‎vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.en.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@
147147
<targetstate="new">Rename '{0}' to '__'</target>
148148
<note />
149149
</trans-unit>
150+
<trans-unitid="6012">
151+
<source>Advanced</source>
152+
<targetstate="new">Advanced</target>
153+
<note />
154+
</trans-unit>
150155
</body>
151156
</file>
152157
</xliff>

‎vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@
147147
<targetstate="translated">Cambiar nombre de "{0}" por "__"</target>
148148
<note />
149149
</trans-unit>
150+
<trans-unitid="6012">
151+
<source>Advanced</source>
152+
<targetstate="new">Advanced</target>
153+
<note />
154+
</trans-unit>
150155
</body>
151156
</file>
152157
</xliff>

‎vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@
147147
<targetstate="translated">Renommer '{0}' en '__'</target>
148148
<note />
149149
</trans-unit>
150+
<trans-unitid="6012">
151+
<source>Advanced</source>
152+
<targetstate="new">Advanced</target>
153+
<note />
154+
</trans-unit>
150155
</body>
151156
</file>
152157
</xliff>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp