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

Commit939050e

Browse files
cartermpKevinRansom
authored andcommitted
Add option to toggle unused declarations analyzer (#4074)
* Add option to toggle unused declarations analyzer* Better name and handle registering code fixes.This will ensure that if someone uses warnon:1182, we won't suggestfixes if they've turned off the feature.
1 parentc6a5a98 commit939050e

20 files changed

+94
-3
lines changed

‎vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ type internal FSharpRenameUnusedValueCodeFixProvider
4747

4848
override__.RegisterCodeFixesAsync context:Task=
4949
asyncMaybe{
50+
// Don't show code fixes for unused values, even if they are compiler-generated.
51+
do! Option.guard Settings.CodeFixes.UnusedDeclarations
52+
5053
letdocument= context.Document
5154
let!sourceText= document.GetTextAsync()
5255
letident= sourceText.ToString(context.Span)

‎vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ type internal UnusedDeclarationsAnalyzer() =
100100

101101
override__.AnalyzeSemanticsAsync(document,cancellationToken)=
102102
asyncMaybe{
103+
do! Option.guard Settings.CodeFixes.UnusedDeclarations
104+
103105
do Trace.TraceInformation("{0:n3} (start) UnusedDeclarationsAnalyzer", DateTime.Now.TimeOfDay.TotalSeconds)
104106
do! Async.Sleep DefaultTuning.UnusedDeclarationsAnalyzerInitialDelay|> liftAsync// be less intrusive, give other work priority most of the time
105107
match getProjectInfoManager(document).TryGetOptionsForEditingDocumentOrProject(document)with

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ type QuickInfoOptions =
3434
typeCodeFixesOptions=
3535
{ SimplifyName:bool
3636
AlwaysPlaceOpensAtTopLevel:bool
37-
UnusedOpens:bool}
37+
UnusedOpens:bool
38+
UnusedDeclarations:bool}
3839

3940
[<CLIMutable>]
4041
typeLanguageServicePerformanceOptions=
@@ -59,7 +60,8 @@ type internal Settings [<ImportingConstructor>](store: SettingsStore) =
5960
// See https://github.com/Microsoft/visualfsharp/pull/3238#issue-237699595
6061
SimplifyName=false
6162
AlwaysPlaceOpensAtTopLevel=false
62-
UnusedOpens=true}
63+
UnusedOpens=true
64+
UnusedDeclarations=true}
6365

6466
store.RegisterDefault
6567
{ EnableInMemoryCrossProjectReferences=true

‎vsintegration/src/FSharp.UIResources/CodeFixesOptionControl.xaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<StackPanelMargin="15 0 0 0"/>
2727
<CheckBoxx:Name="unusedOpens"IsChecked="{Binding UnusedOpens}"
2828
Content="{x:Static local:Strings.Unused_opens_code_fix}"/>
29+
<CheckBoxx:Name="unusedDeclaration"IsChecked="{Binding UnusedDeclarations}"
30+
Content="{x:Static local:Strings.Unused_declaration_code_fix}"/>
2931
</StackPanel>
3032
</GroupBox>
3133
</StackPanel>

‎vsintegration/src/FSharp.UIResources/Strings.Designer.cs‎

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎vsintegration/src/FSharp.UIResources/Strings.resx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,7 @@
165165
<dataname="Unused_opens_code_fix"xml:space="preserve">
166166
<value>Remove unused open statements</value>
167167
</data>
168+
<dataname="Unused_declaration_code_fix"xml:space="preserve">
169+
<value>Analyze and suggest fixes for unused values</value>
170+
</data>
168171
</root>

‎vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
<targetstate="translated">Odebrat nepoužívané otevřené výkazy</target>
8383
<note />
8484
</trans-unit>
85+
<trans-unitid="Unused_declaration_code_fix">
86+
<source>Analyze and suggest fixes for unused values</source>
87+
<targetstate="new">Analyze and suggest fixes for unused values</target>
88+
<note />
89+
</trans-unit>
8590
</body>
8691
</file>
8792
</xliff>

‎vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
<targetstate="translated">Nicht verwendete "open"-Anweisungen entfernen</target>
8383
<note />
8484
</trans-unit>
85+
<trans-unitid="Unused_declaration_code_fix">
86+
<source>Analyze and suggest fixes for unused values</source>
87+
<targetstate="new">Analyze and suggest fixes for unused values</target>
88+
<note />
89+
</trans-unit>
8590
</body>
8691
</file>
8792
</xliff>

‎vsintegration/src/FSharp.UIResources/xlf/Strings.en.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
<targetstate="new">Remove unused open statements</target>
8383
<note />
8484
</trans-unit>
85+
<trans-unitid="Unused_declaration_code_fix">
86+
<source>Analyze and suggest fixes for unused values</source>
87+
<targetstate="new">Analyze and suggest fixes for unused values</target>
88+
<note />
89+
</trans-unit>
8590
</body>
8691
</file>
8792
</xliff>

‎vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
<targetstate="translated">Quitar instrucciones open no usadas</target>
8383
<note />
8484
</trans-unit>
85+
<trans-unitid="Unused_declaration_code_fix">
86+
<source>Analyze and suggest fixes for unused values</source>
87+
<targetstate="new">Analyze and suggest fixes for unused values</target>
88+
<note />
89+
</trans-unit>
8590
</body>
8691
</file>
8792
</xliff>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp