Skip to content
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

Fix up to date check & improve logging #2332

Merged
merged 2 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
xmlns:local="clr-namespace:Microsoft.VisualStudio.Editors.OptionPages">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<CheckBox x:Name="FastUpToDateCheck" x:Uid="General_FastUpToDateCheck" Content="{x:Static r:GeneralOptionPageResources.General_FastUpToDateCheck}" Margin="0" />
<CheckBox x:Name="VerboseFastUpToDateLogging" x:Uid="General_VerboseFastUpToDateLogging" Content="{x:Static r:GeneralOptionPageResources.General_VerboseFastUpToDateLogging}" Margin="0" />
<GroupBox x:Uid="FastUpToDateGroupBox" Header="{x:Static r:GeneralOptionPageResources.General_FastUpToDateCheck_Title}">
<StackPanel Orientation="Vertical">
<CheckBox x:Name="FastUpToDateCheck" x:Uid="General_FastUpToDateCheck" Content="{x:Static r:GeneralOptionPageResources.General_FastUpToDateCheck}" Margin="0" />
<StackPanel Orientation="Horizontal">
<Label Content="{x:Static r:GeneralOptionPageResources.General_FastUpToDateCheck_LogLevel}" Margin="0" />
<ComboBox x:Name="FastUpToDateLogLevel" SelectedIndex="2" ItemsSource="{x:Static local:GeneralOptionPageControl.FastUpToDateLogLevelItemSource}" x:Uid="General_LogLevel" VerticalContentAlignment="Center" Margin="0"/>
</StackPanel>
</StackPanel>
</GroupBox>
</StackPanel>
</ScrollViewer>
</local:OptionPageControl>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages

Private _generalOptions As GeneralOptions

Public Shared ReadOnly FastUpToDateLogLevelItemSource As String() = {
My.Resources.GeneralOptionPageResources.General_FastUpToDateCheck_LogLevel_None,
My.Resources.GeneralOptionPageResources.General_FastUpToDateCheck_LogLevel_Info,
My.Resources.GeneralOptionPageResources.General_FastUpToDateCheck_LogLevel_Verbose
}

Public Sub New(serviceProvider As IServiceProvider)
MyBase.New()

Expand All @@ -27,11 +33,12 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages

binding = New Binding() With {
.Source = _generalOptions,
.Path = New Windows.PropertyPath(NameOf(GeneralOptions.VerboseFastUpToDateLogging)),
.UpdateSourceTrigger = UpdateSourceTrigger.Explicit
.Path = New Windows.PropertyPath(NameOf(GeneralOptions.FastUpToDateLogLevel)),
.UpdateSourceTrigger = UpdateSourceTrigger.Explicit,
.Converter = LoggingLevelToInt32Converter.Instance
}

bindingExpression = VerboseFastUpToDateLogging.SetBinding(CheckBox.IsCheckedProperty, binding)
bindingExpression = FastUpToDateLogLevel.SetBinding(ComboBox.SelectedIndexProperty, binding)
AddBinding(bindingExpression)
End Sub
End Class
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,19 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
<data name="General_FastUpToDateCheck_LogLevel" xml:space="preserve">
<value>Logging Level:</value>
</data>
<data name="General_FastUpToDateCheck_LogLevel_Info" xml:space="preserve">
<value>Info</value>
</data>
<data name="General_FastUpToDateCheck_LogLevel_None" xml:space="preserve">
<value>None</value>
</data>
<data name="General_FastUpToDateCheck_LogLevel_Verbose" xml:space="preserve">
<value>Verbose</value>
</data>
<data name="General_FastUpToDateCheck_Title" xml:space="preserve">
<value>Up to Date Checks</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages
End Class

Private Const FastUpToDateEnabledSettingKey As String = "ManagedProjectSystem\FastUpToDateCheckEnabled"
Private Const VerboseFastUpToDateLoggingSettingKey As String = "ManagedProjectSystem\VerboseFastUpToDateLogging"
Private Const FastUpToDateLogLevelSettingKey As String = "ManagedProjectSystem\FastUpToDateLogLevel"

Private ReadOnly _settingsManager As ISettingsManager

Expand All @@ -23,12 +23,12 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages
End Set
End Property

Public Property VerboseFastUpToDateLogging As Boolean
Public Property FastUpToDateLogLevel As LogLevel
Get
Return If(_settingsManager?.GetValueOrDefault(VerboseFastUpToDateLoggingSettingKey, False), False)
Return If(_settingsManager?.GetValueOrDefault(FastUpToDateLogLevelSettingKey, LogLevel.None), LogLevel.None)
End Get
Set
_settingsManager.SetValueAsync(VerboseFastUpToDateLoggingSettingKey, Value, isMachineLocal:=False)
_settingsManager.SetValueAsync(FastUpToDateLogLevelSettingKey, Value, isMachineLocal:=False)
End Set
End Property

Expand Down
7 changes: 7 additions & 0 deletions src/Microsoft.VisualStudio.Editors/OptionPages/LogLevel.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Public Enum LogLevel
None
Info
Verbose
End Enum
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System.Globalization
Imports System.Windows.Data

Namespace Microsoft.VisualStudio.Editors.OptionPages
Friend NotInheritable Class LoggingLevelToInt32Converter
Implements IValueConverter

Private Shared ReadOnly _instance As New LoggingLevelToInt32Converter()

Public Shared ReadOnly Property Instance As LoggingLevelToInt32Converter
Get
Return _instance
End Get
End Property

Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Debug.Assert(value IsNot Nothing)
Debug.Assert(TypeOf value Is LogLevel)
Debug.Assert([Enum].IsDefined(GetType(LogLevel), value))
Debug.Assert(targetType = GetType(Integer))

Return CInt(CType(value, LogLevel))
End Function

Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Debug.Assert(value IsNot Nothing)
Debug.Assert(TypeOf value Is Integer)
Debug.Assert(CInt(value) >= 0 AndAlso CInt(value) < [Enum].GetValues(GetType(LogLevel)).Length)
Debug.Assert(targetType = GetType(LogLevel))

Return CType(CInt(value), LogLevel)
End Function
End Class
End Namespace
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages
checkBoxStyle.Setters.Add(New Setter(ForegroundProperty, New DynamicResourceExtension(SystemColors.WindowTextBrushKey)))
checkBoxStyle.Setters.Add(New Setter(MarginProperty, New Thickness(left:=0, top:=7, right:=0, bottom:=7)))
Resources.Add(GetType(CheckBox), checkBoxStyle)

Dim comboBoxStyle = New Style(GetType(ComboBox))
comboBoxStyle.Setters.Add(New Setter(ForegroundProperty, New DynamicResourceExtension(SystemColors.WindowTextBrushKey)))
comboBoxStyle.Setters.Add(New Setter(MarginProperty, New Thickness(left:=0, top:=7, right:=0, bottom:=7)))
Resources.Add(GetType(ComboBox), comboBoxStyle)

Dim groupBoxStyle = New Style(GetType(GroupBox))
groupBoxStyle.Setters.Add(New Setter(ForegroundProperty, New DynamicResourceExtension(SystemColors.WindowTextBrushKey)))
groupBoxStyle.Setters.Add(New Setter(MarginProperty, New Thickness(left:=0, top:=0, right:=0, bottom:=3)))
groupBoxStyle.Setters.Add(New Setter(PaddingProperty, New Thickness(left:=7, top:=7, right:=7, bottom:=0)))
Resources.Add(GetType(GroupBox), groupBoxStyle)
End Sub

Protected Sub AddBinding(bindingExpression As BindingExpressionBase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<target state="new">Don't call MSBuild if a project appears to be up to date.</target>
<note></note>
</trans-unit>
<trans-unit id="General_VerboseFastUpToDateLogging">
<source>Log diagnostic information for project up to date checks to the output window.</source>
<target state="new">Log diagnostic information for project up to date checks to the output window.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<target state="new">Don't call MSBuild if a project appears to be up to date.</target>
<note></note>
</trans-unit>
<trans-unit id="General_VerboseFastUpToDateLogging">
<source>Log diagnostic information for project up to date checks to the output window.</source>
<target state="new">Log diagnostic information for project up to date checks to the output window.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<target state="new">Don't call MSBuild if a project appears to be up to date.</target>
<note></note>
</trans-unit>
<trans-unit id="General_VerboseFastUpToDateLogging">
<source>Log diagnostic information for project up to date checks to the output window.</source>
<target state="new">Log diagnostic information for project up to date checks to the output window.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Loading