Skip to content

Commit

Permalink
Address PR feedback from Heejae
Browse files Browse the repository at this point in the history
  • Loading branch information
mavasani committed May 20, 2016
1 parent 7a6f4b5 commit ca0edce
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@
Content="{x:Static local:AdvancedOptionPageStrings.Option_ClosedFileDiagnostics}" />
<CheckBox x:Name="RenameTrackingPreview"
Content="{x:Static local:AdvancedOptionPageStrings.Option_RenameTrackingPreview}" />
<Label x:Name="FullSolutionAnalysisMovedToErrorListLabel"
Content="{x:Static local:AdvancedOptionPageStrings.Label_FullSolutionAnalysisMovedToErrorList}"
Visibility="Collapsed"/>
</StackPanel>
</GroupBox>
<GroupBox x:Uid="ExtractMethodGroupBox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public AdvancedOptionPageControl(IServiceProvider serviceProvider) : base(servic
BindToOption(RenameTrackingPreview, FeatureOnOffOptions.RenameTrackingPreview, LanguageNames.CSharp);
BindToOption(DontPutOutOrRefOnStruct, ExtractMethodOptions.DontPutOutOrRefOnStruct, LanguageNames.CSharp);
BindToOption(AllowMovingDeclaration, ExtractMethodOptions.AllowMovingDeclaration, LanguageNames.CSharp);
BindToFullSolutionAnalysisOption(ClosedFileDiagnostics, FullSolutionAnalysisMovedToErrorListLabel, LanguageNames.CSharp);
BindToFullSolutionAnalysisOption(ClosedFileDiagnostics, LanguageNames.CSharp);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ public static string Option_PlaceSystemNamespaceFirst
get { return CSharpVSResources.Option_PlaceSystemNamespaceFirst; }
}

public static string Label_FullSolutionAnalysisMovedToErrorList
{
get { return ServicesVSResources.FullSolutionAnalysisMovedToErrorList; }
}

public static string Option_Using_Directives =>
CSharpVSResources.Option_Using_Directives;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.Internal.VisualStudio.Shell;
using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
Expand Down Expand Up @@ -57,6 +58,7 @@ public VisualStudioDiagnosticListTable(
var errorList2 = _errorList as IErrorList2;
if (errorList2 != null)
{
workspace.WorkspaceChanged += OnWorkspaceChanged;
errorList2.AnalysisToggleStateChanged += OnErrorListFullSolutionAnalysisToggled;
_optionService.OptionChanged += OnOptionChanged;
}
Expand Down Expand Up @@ -149,6 +151,40 @@ private void OnErrorListPropertyChanged(object sender, PropertyChangedEventArgs
}
}

private void OnWorkspaceChanged(object sender, WorkspaceChangeEventArgs e)
{
Contract.ThrowIfFalse(_errorList is IErrorList2);

switch (e.Kind)
{
case WorkspaceChangeKind.SolutionAdded:
case WorkspaceChangeKind.SolutionChanged:
case WorkspaceChangeKind.SolutionCleared:
case WorkspaceChangeKind.SolutionReloaded:
case WorkspaceChangeKind.SolutionRemoved:
case WorkspaceChangeKind.ProjectAdded:
case WorkspaceChangeKind.ProjectChanged:
case WorkspaceChangeKind.ProjectRemoved:
// Set error list toggle state based on current analysis state for all languages for projects in current solution.
var fullAnalysisState = _optionService.GetOption(RuntimeOptions.FullSolutionAnalysis);
if (fullAnalysisState)
{
var langauges = e.NewSolution.Projects.Select(p => p.Language).Distinct();
foreach (var language in langauges)
{
if (!ServiceFeatureOnOffOptions.IsClosedFileDiagnosticsEnabled(_optionService, language))
{
fullAnalysisState = false;
break;
}
}
}

((IErrorList2)_errorList).AnalysisToggleState = fullAnalysisState;
return;
}
}

private void OnErrorListFullSolutionAnalysisToggled(object sender, AnalysisToggleStateChangedEventArgs e)
{
var newOptions = _optionService.GetOptions()
Expand Down
9 changes: 0 additions & 9 deletions src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/VisualStudio/Core/Def/ServicesVSResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,4 @@ Additional information: {1}</value>
<value>Restore {0}</value>
<comment>{0} is a parameter description</comment>
</data>
<data name="FullSolutionAnalysisMovedToErrorList" xml:space="preserve">
<value>Note: Option 'Enable full solution analysis' has been moved to the Error List.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,18 @@ protected void BindToOption(TextBox textBox, PerLanguageOption<int> optionKey, s
_bindingExpressions.Add(bindingExpression);
}

protected void BindToFullSolutionAnalysisOption(CheckBox checkbox, Label fullSolutionAnalysisMovedToErrorListLabel, string languageName)
protected void BindToFullSolutionAnalysisOption(CheckBox checkbox, string languageName)
{
// Full solution analysis option has been moved to error list from Dev14 Update3.
// We only want to show the full solution analysis option in Tools Options, if we are running against prior VS bits.
if (VisualStudioDiagnosticListTable.ErrorListHasFullSolutionAnalysisButton())
{
checkbox.Visibility = Visibility.Collapsed;
fullSolutionAnalysisMovedToErrorListLabel.Visibility = Visibility.Visible;
return;
}

checkbox.Visibility = Visibility.Visible;
fullSolutionAnalysisMovedToErrorListLabel.Visibility = Visibility.Collapsed;


Binding binding = new Binding()
{
Source = new FullSolutionAnalysisOptionBinding(OptionService, languageName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
Content="{x:Static local:AdvancedOptionPageStrings.Option_ClosedFileDiagnostics}" />
<CheckBox x:Name="RenameTrackingPreview"
Content="{x:Static local:AdvancedOptionPageStrings.Option_RenameTrackingPreview}" />
<Label x:Name="FullSolutionAnalysisMovedToErrorListLabel"
Content="{x:Static local:AdvancedOptionPageStrings.Label_FullSolutionAnalysisMovedToErrorList}"
Visibility="Collapsed"/>
</StackPanel>
</GroupBox>
<GroupBox x:Uid="GoToDefinitionGroupBox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options
BindToOption(NavigateToObjectBrowser, VisualStudioNavigationOptions.NavigateToObjectBrowser, LanguageNames.VisualBasic)
BindToOption(DontPutOutOrRefOnStruct, ExtractMethodOptions.DontPutOutOrRefOnStruct, LanguageNames.VisualBasic)
BindToOption(AllowMovingDeclaration, ExtractMethodOptions.AllowMovingDeclaration, LanguageNames.VisualBasic)
BindToFullSolutionAnalysisOption(ClosedFileDiagnostics, FullSolutionAnalysisMovedToErrorListLabel, LanguageNames.VisualBasic)
BindToFullSolutionAnalysisOption(ClosedFileDiagnostics, LanguageNames.VisualBasic)
End Sub
End Class
End Namespace
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,5 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options
Return BasicVSResources.Option_Suggest_imports_for_types_in_NuGet_packages
End Get
End Property

Public ReadOnly Property Label_FullSolutionAnalysisMovedToErrorList As String
Get
Return ServicesVSResources.FullSolutionAnalysisMovedToErrorList
End Get
End Property
End Module
End Namespace

0 comments on commit ca0edce

Please sign in to comment.