Skip to content

Commit

Permalink
Merge pull request #46 from GeorgeAlexandria/vs_existing_classification
Browse files Browse the repository at this point in the history
Append classification for types
  • Loading branch information
GeorgeAlexandria committed Oct 26, 2018
2 parents e1a5104 + b451911 commit 2b5b7a2
Show file tree
Hide file tree
Showing 76 changed files with 1,280 additions and 238 deletions.
10 changes: 10 additions & 0 deletions Tests/Identifiers/CSharpIdentifiers/Access/Types/ClassType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace CSharpIdentifiers.Access.Types
{
internal class ClassType
{
private void Method()
{
var value = new ClassType();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace CSharpIdentifiers.Access.Types
{
internal class DelegateType
{
internal delegate void Handle();

public Handle Handler;
}
}
11 changes: 11 additions & 0 deletions Tests/Identifiers/CSharpIdentifiers/Access/Types/EnumType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace CSharpIdentifiers.Access.Types
{
internal class EnumType
{
internal enum MyEnum
{
}

private readonly MyEnum value;
}
}
11 changes: 11 additions & 0 deletions Tests/Identifiers/CSharpIdentifiers/Access/Types/InterfaceType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace CSharpIdentifiers.Access.Types
{
internal interface IInterfaceType
{
}

internal class InterfaceType
{
private readonly IInterfaceType value;
}
}
10 changes: 10 additions & 0 deletions Tests/Identifiers/CSharpIdentifiers/Access/Types/StructureType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace CSharpIdentifiers.Access.Types
{
internal struct StructureType
{
private void Method()
{
var value = new StructureType();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace CSharpIdentifiers.Access.Types
{
internal class TypeParameter<TValue> where TValue : new()
{
private TValue Value => new TValue();
}
}
12 changes: 12 additions & 0 deletions Tests/Identifiers/CSharpIdentifiers/CSharpIdentifiers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
<Compile Include="Access\Methods\Method.cs" />
<Compile Include="Access\Methods\StaticMethod.cs" />
<Compile Include="Access\Namespaces\CustomNamespaces.cs" />
<Compile Include="Access\Types\ClassType.cs" />
<Compile Include="Access\Types\DelegateType.cs" />
<Compile Include="Access\Types\EnumType.cs" />
<Compile Include="Access\Types\InterfaceType.cs" />
<Compile Include="Access\Types\StructureType.cs" />
<Compile Include="Access\Types\TypeParameter.cs" />
<Compile Include="AnalyzeOptions\AliasNamespace.cs" />
<Compile Include="AnalyzeOptions\LocalVariable.cs" />
<Compile Include="AnalyzeOptions\Member.cs" />
Expand Down Expand Up @@ -117,6 +123,12 @@
<Compile Include="Declarations\Parameters\Variable.cs" />
<Compile Include="Declarations\Parameters\Optional.cs" />
<Compile Include="Declarations\Parameters\SimpleParameter.cs" />
<Compile Include="Declarations\Types\ClassType.cs" />
<Compile Include="Declarations\Types\DelegateType.cs" />
<Compile Include="Declarations\Types\EnumType.cs" />
<Compile Include="Declarations\Types\InterfaceType.cs" />
<Compile Include="Declarations\Types\StructureType.cs" />
<Compile Include="Declarations\Types\TypeParameter.cs" />
<Compile Include="XmlDocComment\TypeParam.cs" />
<Compile Include="XmlDocComment\TypeParamRef.cs" />
<Compile Include="XmlDocComment\CrefAttribute.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace CSharpIdentifiers.Declarations.Types
{
internal class ClassType
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace CSharpIdentifiers.Declarations.Types
{
internal delegate void Handle();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace CSharpIdentifiers.Declarations.Types
{
internal enum EnumType
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace CSharpIdentifiers.Declarations.Types
{
internal interface InterfaceType
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace CSharpIdentifiers.Declarations.Types
{
internal struct StructureType
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace CSharpIdentifiers.Declarations.Types
{
internal class TypeParameter<TIn>
{
public void Method<TOther>()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Namespace Access.Types

Public Class ClassType

Public field As ClassType

End Class

End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Namespace Access.Types

Public Class DelegateType

Public Delegate Sub Handle()

Public field As Handle

End Class

End Namespace
13 changes: 13 additions & 0 deletions Tests/Identifiers/VisualBasicIdentifiers/Access/Types/EnumType.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Namespace Access.Types

Public Class EnumType

Public Enum MyEnum
V
End Enum

Public field As MyEnum

End Class

End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Namespace Access.Types

Public Class InterfaceType

Public Interface IInterfaceType

End Interface

Public field As IInterfaceType
End Class

End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Namespace Access.Types
Public Module ModuleType

Public field As Integer

Sub Method()
Dim value = ModuleType.field
End Sub

End Module
End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Namespace Access.Types

Public Structure StructureType

Sub Method()
Dim value = New StructureType()
End Sub

End Structure

End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Namespace Access.Types

Public Class TypeParameter(Of TValue)
Public fiedl As TValue
End Class

End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Public Class ClassType

End Class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Public Delegate Sub DelegateType()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Public Enum EnumType
V
End Enum
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Public Interface InterfaceType

End Interface
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Module ModuleType

End Module
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Public Structure StructureType

End Structure
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Public Class TypeParameter(Of TValue)

End Class
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
<Compile Include="Access\Parameters\DelegateParameter.vb" />
<Compile Include="Access\Parameters\OptionalParameter.vb" />
<Compile Include="Access\Parameters\Variable.vb" />
<Compile Include="Access\Types\ClassType.vb" />
<Compile Include="Access\Types\DelegateType.vb" />
<Compile Include="Access\Types\EnumType.vb" />
<Compile Include="Access\Types\InterfaceType.vb" />
<Compile Include="Access\Types\ModuleType.vb" />
<Compile Include="Access\Types\StructureType.vb" />
<Compile Include="Access\Types\TypeParameter.vb" />
<Compile Include="AnalyzeOptions\LocalVariable.vb" />
<Compile Include="AnalyzeOptions\Member.vb" />
<Compile Include="AnalyzeOptions\Method.vb" />
Expand Down Expand Up @@ -141,6 +148,13 @@
<Compile Include="Declarations\Parameters\SimpleParameter.vb" />
<Compile Include="Declarations\Parameters\TypeCharacter.vb" />
<Compile Include="Declarations\Parameters\Variable.vb" />
<Compile Include="Declarations\Types\ClassType.vb" />
<Compile Include="Declarations\Types\DelegateType.vb" />
<Compile Include="Declarations\Types\EnumType.vb" />
<Compile Include="Declarations\Types\InterfaceType.vb" />
<Compile Include="Declarations\Types\ModuleType.vb" />
<Compile Include="Declarations\Types\StructureType.vb" />
<Compile Include="Declarations\Types\TypeParameter.vb" />
<Compile Include="Example.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
Expand Down
13 changes: 7 additions & 6 deletions src/common/CoCo.MsBuild/MsBuildEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ public MsBuildEngine(Logger logger)
for (int i = 0; i < projectFileNames.Length; ++i)
{
var projectGlobalProperties = globalProperties[i];
var properties = new Dictionary<string, string>(projectGlobalProperties.Count);
Dictionary<string, string> properties = null;
if (projectGlobalProperties != null)
{
properties = new Dictionary<string, string>(projectGlobalProperties.Count);
var removeProjectProperties = removeGlobalProperties[i];
foreach (DictionaryEntry item in projectGlobalProperties)
{
if (item.Key is string key && (removeGlobalProperties == null || !removeProjectProperties.Contains(key)))
if (item.Key is string key && (removeProjectProperties is null || !removeProjectProperties.Contains(key)))
{
properties.Add(key, item.Value as string);
}
Expand All @@ -131,15 +132,15 @@ public MsBuildEngine(Logger logger)
}
}

var project = new Project(projectFileNames[i], properties, existingToolsVersion);
var result = project.CreateProjectInstance().Build(targetNames, new ILogger[0], out var targetOuputs);
var project = new Project(projectFileNames[i], properties ?? new Dictionary<string, string>(), existingToolsVersion);
var result = project.CreateProjectInstance().Build(targetNames, new ILogger[0], out var targetOutputs);
if (!result) _logger.Error("{0} project was failed to build", projectFileNames[i]);
allSuccess &= result;

if (returnTargetOutputs)
{
var projectTargetOutputs = new Dictionary<string, ITaskItem[]>(targetOuputs.Count);
foreach (var item in targetOuputs)
var projectTargetOutputs = new Dictionary<string, ITaskItem[]>(targetOutputs.Count);
foreach (var item in targetOutputs)
{
projectTargetOutputs.Add(item.Key, item.Value.Items);
}
Expand Down
1 change: 0 additions & 1 deletion src/common/CoCo.UI/UI/PresetsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
Margin="8,0,8,0"
Command="{Binding ApplyPreset}"
CommandParameter="{Binding}"
Foreground="#5e5e5a"
Style="{StaticResource commonButtonStyle}"
Template="{StaticResource ApplyPresetButton}" />
<Button
Expand Down
5 changes: 3 additions & 2 deletions src/common/CoCo.UI/ViewModels/ClassificationColorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace CoCo.UI.ViewModels
/// </summary>
public class ClassificationColorViewModel : BaseViewModel
{
public ClassificationColorViewModel(Color classificationColor, bool colorWasReset, IResetValuesProvider resetValuesProvider)
public ClassificationColorViewModel(
string classificationName, Color classificationColor, bool colorWasReset, IResetValuesProvider resetValuesProvider)
{
_color = classificationColor;
_colorText = _color.ToString();
Expand All @@ -25,7 +26,7 @@ public ClassificationColorViewModel(Color classificationColor, bool colorWasRese
});
ResetColor = new DelegateCommand(() =>
{
Color = resetValuesProvider.Foreground;
Color = resetValuesProvider.GetForeground(classificationName);
ColorWasReset = true;
});

Expand Down
6 changes: 3 additions & 3 deletions src/common/CoCo.UI/ViewModels/ClassificationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ public ClassificationViewModel(Classification classification, IResetValuesProvid
_fontRenderingSize = classification.FontRenderingSize;

Foreground = new ClassificationColorViewModel(
classification.Foreground, classification.ForegroundWasReset, resetValuesProvider);
_classificationName, classification.Foreground, classification.ForegroundWasReset, resetValuesProvider);
Background = new ClassificationColorViewModel(
classification.Background, classification.BackgroundWasReset, resetValuesProvider);
_classificationName, classification.Background, classification.BackgroundWasReset, resetValuesProvider);

_fontRenderingSizeWasReset = classification.FontRenderingSizeWasReset;

DisplayName = classification.DisplayName;

ResetFontRenderingSize = new DelegateCommand(() =>
{
SetProperty(ref _fontRenderingSize, resetValuesProvider.FontRenderingSize, nameof(Size));
SetProperty(ref _fontRenderingSize, resetValuesProvider.GetFontRenderingSize(_classificationName), nameof(Size));
_fontRenderingSizeWasReset = true;
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/CoCo.UI/ViewModels/IResetValuesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace CoCo.UI.ViewModels
/// </remarks>
public interface IResetValuesProvider
{
Color Foreground { get; }
Color GetForeground(string name);

Color Background { get; }
Color GetBackground(string name);

int FontRenderingSize { get; }
int GetFontRenderingSize(string name);
}
}

0 comments on commit 2b5b7a2

Please sign in to comment.