diff --git a/Analyzers/Directory.build.props b/Analyzers/Directory.build.props
new file mode 100644
index 000000000..1257675c1
--- /dev/null
+++ b/Analyzers/Directory.build.props
@@ -0,0 +1,23 @@
+
+
+ enable
+ latest-recommended
+ 7
+ UTF-8
+ true
+ true
+ $(DefineConstants);JETBRAINS_ANNOTATIONS;CONTRACTS_FULL;CODE_ANALYSIS
+ True
+ True
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal.Debugging/Terminal.Gui.Analyzers.Internal.Debugging.csproj b/Analyzers/Terminal.Gui.Analyzers.Internal.Debugging/Terminal.Gui.Analyzers.Internal.Debugging.csproj
index 03b5cf379..3cad5995b 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal.Debugging/Terminal.Gui.Analyzers.Internal.Debugging.csproj
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal.Debugging/Terminal.Gui.Analyzers.Internal.Debugging.csproj
@@ -4,7 +4,6 @@
Exe
net8.0
enable
- enable
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Terminal.Gui.Analyzers.Internal.Tests.csproj b/Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Terminal.Gui.Analyzers.Internal.Tests.csproj
index 4020bd357..57846424a 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Terminal.Gui.Analyzers.Internal.Tests.csproj
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Terminal.Gui.Analyzers.Internal.Tests.csproj
@@ -4,15 +4,12 @@
net8.0
enable
12
- enable
false
true
true
- True
portable
$(DefineConstants);JETBRAINS_ANNOTATIONS;CONTRACTS_FULL;CODE_ANALYSIS
enable
- True
true
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/AssemblyExtendedEnumTypeAttribute.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/AssemblyExtendedEnumTypeAttribute.cs
index 6115fdc46..da340e075 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/AssemblyExtendedEnumTypeAttribute.cs
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/AssemblyExtendedEnumTypeAttribute.cs
@@ -1,4 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global
+// ReSharper disable once RedundantNullableDirective
#nullable enable
namespace Terminal.Gui.Analyzers.Internal.Attributes;
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/CombinationGroupingAttribute.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/CombinationGroupingAttribute.cs
deleted file mode 100644
index 22d8eafd3..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/CombinationGroupingAttribute.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using JetBrains.Annotations;
-
-namespace Terminal.Gui.Analyzers.Internal.Attributes;
-
-///
-/// Designates an enum member for inclusion in generation of bitwise combinations with other members decorated with
-/// this attribute which have the same value.
-///
-///
-/// This attribute is only considered for members of enum types which have the
-/// .
-///
-[AttributeUsage (AttributeTargets.Field)]
-[UsedImplicitly]
-internal sealed class CombinationGroupingAttribute : Attribute
-{
- ///
- /// Name of a group this member participates in, for FastHasFlags.
- ///
- public string GroupTag { get; set; }
-}
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/GenerateEnumMemberCombinationsAttribute.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/GenerateEnumMemberCombinationsAttribute.cs
deleted file mode 100644
index 77d0c13a2..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Attributes/GenerateEnumMemberCombinationsAttribute.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-// ReSharper disable RedundantUsingDirective
-
-using System;
-using JetBrains.Annotations;
-using Terminal.Gui.Analyzers.Internal.Compatibility;
-
-namespace Terminal.Gui.Analyzers.Internal.Attributes;
-
-///
-/// Designates an enum member for inclusion in generation of bitwise combinations with other members decorated with
-/// this attribute which have the same value.
-///
-///
-///
-/// This attribute is only considered for enum types with the .
-///
-///
-[AttributeUsage (AttributeTargets.Enum)]
-[UsedImplicitly]
-public sealed class GenerateEnumMemberCombinationsAttribute : System.Attribute
-{
- private const byte MaximumPopCountLimit = 14;
- private uint _mask;
- private uint _maskPopCount;
- private byte _popCountLimit = 8;
- ///
- public string GroupTag { get; set; }
-
- ///
- /// The mask for the group defined in
- ///
- public uint Mask
- {
- get => _mask;
- set
- {
-#if NET8_0_OR_GREATER
- _maskPopCount = uint.PopCount (value);
-#else
- _maskPopCount = value.GetPopCount ();
-#endif
- PopCountLimitExceeded = _maskPopCount > PopCountLimit;
- MaximumPopCountLimitExceeded = _maskPopCount > MaximumPopCountLimit;
-
- if (PopCountLimitExceeded || MaximumPopCountLimitExceeded)
- {
- return;
- }
-
- _mask = value;
- }
- }
-
- ///
- /// The maximum number of bits allowed to be set to 1 in .
- ///
- ///
- ///
- /// Default: 8 (256 possible combinations)
- ///
- ///
- /// Increasing this value is not recommended!
- /// Decreasing this value is pointless unless you want to limit maximum possible generated combinations even
- /// further.
- ///
- ///
- /// If the result of () exceeds 2 ^
- /// , no
- /// combinations will be generated for the members which otherwise would have been included by .
- /// Values exceeding the actual population count of have no effect.
- ///
- ///
- /// This option is set to a sane default of 8, but also has a hard-coded limit of 14 (16384 combinations), as a
- /// protection against generation of extremely large files.
- ///
- ///
- /// CAUTION: The maximum number of possible combinations possible is equal to 1 <<
- /// ().
- /// See for hard-coded limit,
- ///
- ///
- public byte PopCountLimit
- {
- get => _popCountLimit;
- set
- {
-#if NET8_0_OR_GREATER
- _maskPopCount = uint.PopCount (_mask);
-#else
- _maskPopCount = _mask.GetPopCount ();
-#endif
-
- PopCountLimitExceeded = _maskPopCount > value;
- MaximumPopCountLimitExceeded = _maskPopCount > MaximumPopCountLimit;
-
- if (PopCountLimitExceeded || MaximumPopCountLimitExceeded)
- {
- return;
- }
-
- _mask = value;
- _popCountLimit = value;
- }
- }
-
- [UsedImplicitly]
- internal bool MaximumPopCountLimitExceeded { get; private set; }
- [UsedImplicitly]
- internal bool PopCountLimitExceeded { get; private set; }
-}
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/CompilerFeatureRequiredAttribute.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/CompilerFeatureRequiredAttribute.cs
deleted file mode 100644
index cefddff94..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/CompilerFeatureRequiredAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices;
-
-///
-/// Indicates that compiler support for a particular feature is required for the location where this attribute is
-/// applied.
-///
-[AttributeUsage (AttributeTargets.All, AllowMultiple = true, Inherited = false)]
-internal sealed class CompilerFeatureRequiredAttribute(string featureName) : Attribute
-{
- ///
- /// The used for the ref structs C# feature.
- ///
- public const string RefStructs = nameof (RefStructs);
-
- ///
- /// The used for the required members C# feature.
- ///
- public const string RequiredMembers = nameof (RequiredMembers);
-
- ///
- /// The name of the compiler feature.
- ///
- public string FeatureName { get; } = featureName;
- ///
- /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not
- /// understand .
- ///
- public bool IsOptional { get; init; }
-}
\ No newline at end of file
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/IsExternalInit.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/IsExternalInit.cs
deleted file mode 100644
index 4976ee705..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/IsExternalInit.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-
-// ReSharper disable CheckNamespace
-namespace System.Runtime.CompilerServices;
-
-///
-/// Reserved to be used by the compiler for tracking metadata.
-/// This class should not be used by developers in source code.
-///
-///
-/// Copied from .net source code, for support of init property accessors in netstandard2.0.
-///
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-[EditorBrowsable (EditorBrowsableState.Never)]
-public static class IsExternalInit;
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/NullableAttributes.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/NullableAttributes.cs
deleted file mode 100644
index 11ef7e4cf..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/NullableAttributes.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-//
-// This file is further modified from the original, for this project,
-// to comply with project style.
-// No changes are made which affect compatibility with the same types from
-// APIs later than netstandard2.0, nor will this file be included in compilations
-// targeted at later APIs.
-//
-// Originally rom https://github.com/dotnet/runtime/blob/ef72b95937703e485fdbbb75f3251fedfd1a0ef9/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs
-
-// ReSharper disable CheckNamespace
-
-// ReSharper disable UnusedAutoPropertyAccessor.Global
-// ReSharper disable UnusedType.Global
-
-namespace System.Diagnostics.CodeAnalysis;
-
-/// Specifies that null is allowed as an input even if the corresponding type disallows it.
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class AllowNullAttribute : Attribute;
-
-/// Specifies that null is disallowed as an input even if the corresponding type allows it.
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class DisallowNullAttribute : Attribute;
-
-/// Specifies that an output may be null even if the corresponding type disallows it.
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class MaybeNullAttribute : Attribute;
-
-///
-/// Specifies that an output will not be null even if the corresponding type allows it. Specifies that an input
-/// argument was not null when the call returns.
-///
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class NotNullAttribute : Attribute;
-
-///
-/// Specifies that when a method returns , the parameter may be null even if the corresponding
-/// type disallows it.
-///
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Parameter)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class MaybeNullWhenAttribute : Attribute
-{
- /// Initializes the attribute with the specified return value condition.
- ///
- /// The return value condition. If the method returns this value, the associated parameter may be null.
- ///
-#pragma warning disable IDE0290 // Use primary constructor
- public MaybeNullWhenAttribute (bool returnValue) { ReturnValue = returnValue; }
-#pragma warning restore IDE0290 // Use primary constructor
-
- /// Gets the return value condition.
- public bool ReturnValue { get; }
-}
-
-///
-/// Specifies that when a method returns , the parameter will not be null even if the
-/// corresponding type allows it.
-///
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Parameter)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class NotNullWhenAttribute : Attribute
-{
- /// Initializes the attribute with the specified return value condition.
- ///
- /// The return value condition. If the method returns this value, the associated parameter will not be null.
- ///
-#pragma warning disable IDE0290 // Use primary constructor
- public NotNullWhenAttribute (bool returnValue) { ReturnValue = returnValue; }
-#pragma warning restore IDE0290 // Use primary constructor
-
- /// Gets the return value condition.
- public bool ReturnValue { get; }
-}
-
-/// Specifies that the output will be non-null if the named parameter is non-null.
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class NotNullIfNotNullAttribute : Attribute
-{
- /// Initializes the attribute with the associated parameter name.
- ///
- /// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null.
- ///
-#pragma warning disable IDE0290 // Use primary constructor
- public NotNullIfNotNullAttribute (string parameterName) { ParameterName = parameterName; }
-#pragma warning restore IDE0290 // Use primary constructor
-
- /// Gets the associated parameter name.
- public string ParameterName { get; }
-}
-
-/// Applied to a method that will never return under any circumstance.
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Method, Inherited = false)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class DoesNotReturnAttribute : Attribute;
-
-/// Specifies that the method will not return if the associated Boolean parameter is passed the specified value.
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Parameter)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class DoesNotReturnIfAttribute : Attribute
-{
- /// Initializes the attribute with the specified parameter value.
- ///
- /// The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument
- /// to
- /// the associated parameter matches this value.
- ///
-#pragma warning disable IDE0290 // Use primary constructor
- public DoesNotReturnIfAttribute (bool parameterValue) { ParameterValue = parameterValue; }
-#pragma warning restore IDE0290 // Use primary constructor
-
- /// Gets the condition parameter value.
- public bool ParameterValue { get; }
-}
-
-///
-/// Specifies that the method or property will ensure that the listed field and property members have not-null
-/// values.
-///
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class MemberNotNullAttribute : Attribute
-{
- /// Initializes the attribute with a field or property member.
- ///
- /// The field or property member that is promised to be not-null.
- ///
- public MemberNotNullAttribute (string member) { Members = [member]; }
-
- /// Initializes the attribute with the list of field and property members.
- ///
- /// The list of field and property members that are promised to be not-null.
- ///
- public MemberNotNullAttribute (params string [] members) { Members = members; }
-
- /// Gets field or property member names.
- public string [] Members { get; }
-}
-
-///
-/// Specifies that the method or property will ensure that the listed field and property members have not-null values
-/// when returning with the specified return value condition.
-///
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
-[ExcludeFromCodeCoverage]
-[DebuggerNonUserCode]
-internal sealed class MemberNotNullWhenAttribute : Attribute
-{
- /// Initializes the attribute with the specified return value condition and a field or property member.
- ///
- /// The return value condition. If the method returns this value, the associated parameter will not be null.
- ///
- ///
- /// The field or property member that is promised to be not-null.
- ///
- public MemberNotNullWhenAttribute (bool returnValue, string member)
- {
- ReturnValue = returnValue;
- Members = [member];
- }
-
- /// Initializes the attribute with the specified return value condition and list of field and property members.
- ///
- /// The return value condition. If the method returns this value, the associated parameter will not be null.
- ///
- ///
- /// The list of field and property members that are promised to be not-null.
- ///
- public MemberNotNullWhenAttribute (bool returnValue, params string [] members)
- {
- ReturnValue = returnValue;
- Members = members;
- }
-
- /// Gets field or property member names.
- public string [] Members { get; }
-
- /// Gets the return value condition.
- public bool ReturnValue { get; }
-}
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/RequiredMemberAttribute.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/RequiredMemberAttribute.cs
deleted file mode 100644
index 2fb8d3841..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/RequiredMemberAttribute.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// ReSharper disable CheckNamespace
-// ReSharper disable ConditionalAnnotation
-
-using JetBrains.Annotations;
-
-namespace System.Runtime.CompilerServices;
-
-/// Polyfill to enable netstandard2.0 assembly to use the required keyword.
-/// Excluded from output assembly via file specified in ApiCompatExcludeAttributesFile element in the project file.
-[AttributeUsage (AttributeTargets.Property)]
-[UsedImplicitly]
-public sealed class RequiredMemberAttribute : Attribute;
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/SetsRequiredMembersAttribute.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/SetsRequiredMembersAttribute.cs
deleted file mode 100644
index ae09ae2cf..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/SetsRequiredMembersAttribute.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-// ReSharper disable once CheckNamespace
-namespace System.Diagnostics.CodeAnalysis;
-
-///
-/// Specifies that this constructor sets all required members for the current type, and callers
-/// do not need to set any required members themselves.
-///
-[AttributeUsage (AttributeTargets.Constructor)]
-public sealed class SetsRequiredMembersAttribute : Attribute;
\ No newline at end of file
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/SkipLocalsInitAttribute.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/SkipLocalsInitAttribute.cs
deleted file mode 100644
index 1eb617362..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Compatibility/SkipLocalsInitAttribute.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace System.Runtime.CompilerServices;
-
-[AttributeUsage (
- AttributeTargets.Class
- | AttributeTargets.Constructor
- | AttributeTargets.Event
- | AttributeTargets.Interface
- | AttributeTargets.Method
- | AttributeTargets.Module
- | AttributeTargets.Property
- | AttributeTargets.Struct,
- Inherited = false)]
-
-internal sealed class SkipLocalsInitAttribute : Attribute;
\ No newline at end of file
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Constants/Strings.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Constants/Strings.cs
index e03d5fcc3..3ffb234a6 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Constants/Strings.cs
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal/Constants/Strings.cs
@@ -46,7 +46,7 @@ internal static class Strings
///
internal const string ExcludeFromCodeCoverage = $"{Namespaces.System_Diagnostics_CodeAnalysis}.{nameof (ExcludeFromCodeCoverageAttribute)}";
- internal const string Flags = $"{Namespaces.SystemNS}.{nameof (FlagsAttribute)}";
+ internal const string Flags = $"{Namespaces.SystemNs}.{nameof (FlagsAttribute)}";
internal const string GeneratedCode = $"{Namespaces.System_CodeDom_Compiler}.{nameof (GeneratedCodeAttribute)}";
@@ -83,22 +83,24 @@ internal static class Strings
/// Names of dotnet namespaces.
internal static class Namespaces
{
- internal const string SystemNS = nameof (System);
- internal const string System_CodeDom = $"{SystemNS}.{nameof (System.CodeDom)}";
+ internal const string SystemNs = nameof (System);
+ // ReSharper disable InconsistentNaming
+ internal const string System_CodeDom = $"{SystemNs}.{nameof (System.CodeDom)}";
internal const string System_CodeDom_Compiler = $"{System_CodeDom}.{nameof (System.CodeDom.Compiler)}";
- internal const string System_ComponentModel = $"{SystemNS}.{nameof (System.ComponentModel)}";
- internal const string System_Diagnostics = $"{SystemNS}.{nameof (System.Diagnostics)}";
+ internal const string System_ComponentModel = $"{SystemNs}.{nameof (System.ComponentModel)}";
+ internal const string System_Diagnostics = $"{SystemNs}.{nameof (System.Diagnostics)}";
internal const string System_Diagnostics_CodeAnalysis = $"{System_Diagnostics}.{nameof (System.Diagnostics.CodeAnalysis)}";
- internal const string System_Numerics = $"{SystemNS}.{nameof (System.Numerics)}";
- internal const string System_Runtime = $"{SystemNS}.{nameof (System.Runtime)}";
+ internal const string System_Numerics = $"{SystemNs}.{nameof (System.Numerics)}";
+ internal const string System_Runtime = $"{SystemNs}.{nameof (System.Runtime)}";
internal const string System_Runtime_CompilerServices = $"{System_Runtime}.{nameof (System.Runtime.CompilerServices)}";
+ // ReSharper restore InconsistentNaming
}
internal static class Types
{
- internal const string Attribute = $"{Namespaces.SystemNS}.{nameof (System.Attribute)}";
- internal const string AttributeTargets = $"{Namespaces.SystemNS}.{nameof (System.AttributeTargets)}";
- internal const string AttributeUsageAttribute = $"{Namespaces.SystemNS}.{nameof (System.AttributeUsageAttribute)}";
+ internal const string Attribute = $"{Namespaces.SystemNs}.{nameof (System.Attribute)}";
+ internal const string AttributeTargets = $"{Namespaces.SystemNs}.{nameof (System.AttributeTargets)}";
+ internal const string AttributeUsageAttribute = $"{Namespaces.SystemNs}.{nameof (System.AttributeUsageAttribute)}";
internal const string MethodImplOptions =
$"{Namespaces.System_Runtime_CompilerServices}.{nameof (System.Runtime.CompilerServices.MethodImplOptions)}";
@@ -131,7 +133,7 @@ internal static class Strings
/// Using directives for common namespaces in generated code.
internal const string DotnetNamespaceUsingDirectives = $"""
- using {DotnetNames.Namespaces.SystemNS};
+ using {DotnetNames.Namespaces.SystemNs};
using {DotnetNames.Namespaces.System_CodeDom};
using {DotnetNames.Namespaces.System_CodeDom_Compiler};
using {DotnetNames.Namespaces.System_ComponentModel};
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/CodeWriter.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/CodeWriter.cs
index 230d6293b..f35e20d88 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/CodeWriter.cs
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/CodeWriter.cs
@@ -147,14 +147,14 @@ internal sealed class CodeWriter (in EnumExtensionMethodsGenerationInfo metadata
switch (Metadata.EnumBackingTypeCode)
{
case TypeCode.Int32:
- foreach (int definedValue in Metadata.IntMembers)
+ foreach (int definedValue in Metadata._intMembers)
{
w.WriteLine ($"{definedValue:D} => true,");
}
break;
case TypeCode.UInt32:
- foreach (uint definedValue in Metadata.UIntMembers)
+ foreach (uint definedValue in Metadata._uIntMembers)
{
w.WriteLine ($"{definedValue:D} => true,");
}
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsGenerationInfo.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsGenerationInfo.cs
index 970c51c35..cab633cbf 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsGenerationInfo.cs
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsGenerationInfo.cs
@@ -24,15 +24,13 @@ namespace Terminal.Gui.Analyzers.Internal.Generators.EnumExtensions;
internal sealed record EnumExtensionMethodsGenerationInfo : IGeneratedTypeMetadata,
IEqualityOperators
{
- private const int ExplicitFastHasFlagsMask = 0b1000;
- private const int ExplicitFastIsDefinedMask = 0b1_0000;
- private const int ExplicitIncludeInterfaceMask = 0b10_0000;
- private const int ExplicitNameMask = 0b10;
- private const int ExplicitNamespaceMask = 0b1;
- private const int ExplicitPartialMask = 0b100;
+ private const int ExplicitFastHasFlagsMask = 0b_0100;
+ private const int ExplicitFastIsDefinedMask = 0b_1000;
+ private const int ExplicitNameMask = 0b_0010;
+ private const int ExplicitNamespaceMask = 0b_0001;
private const string GeneratorAttributeFullyQualifiedName = $"{GeneratorAttributeNamespace}.{GeneratorAttributeName}";
private const string GeneratorAttributeName = nameof (GenerateEnumExtensionMethodsAttribute);
- private const string GeneratorAttributeNamespace = Constants.Strings.AnalyzersAttributesNamespace;
+ private const string GeneratorAttributeNamespace = Strings.AnalyzersAttributesNamespace;
///
/// Type containing the information necessary to generate code according to the declared attribute values,
@@ -90,7 +88,7 @@ internal sealed record EnumExtensionMethodsGenerationInfo : IGeneratedTypeMetada
}
[AccessedThroughProperty (nameof (EnumBackingTypeCode))]
- private TypeCode _enumBackingTypeCode;
+ private readonly TypeCode _enumBackingTypeCode;
[AccessedThroughProperty (nameof (GeneratedTypeName))]
private string? _generatedTypeName;
@@ -159,7 +157,7 @@ internal sealed record EnumExtensionMethodsGenerationInfo : IGeneratedTypeMetada
public bool IsStatic => true;
///
- public bool IncludeInterface { get; private set; }
+ public bool IncludeInterface => false;
public string GeneratedTypeFullName => $"{GeneratedTypeNamespace}.{GeneratedTypeName}";
@@ -189,7 +187,7 @@ internal sealed record EnumExtensionMethodsGenerationInfo : IGeneratedTypeMetada
public TypeCode EnumBackingTypeCode
{
get => _enumBackingTypeCode;
- set
+ init
{
if (value is not TypeCode.Int32 and not TypeCode.UInt32)
{
@@ -208,8 +206,8 @@ internal sealed record EnumExtensionMethodsGenerationInfo : IGeneratedTypeMetada
/// Whether a switch-based IsDefined replacement will be generated (Default: true)
public bool GenerateFastIsDefined { [UsedImplicitly]get; set; } = true;
- internal ImmutableHashSet? IntMembers;
- internal ImmutableHashSet? UIntMembers;
+ internal ImmutableHashSet? _intMembers;
+ internal ImmutableHashSet? _uIntMembers;
///
/// Fully-qualified name of the extension class
@@ -309,11 +307,11 @@ internal sealed record EnumExtensionMethodsGenerationInfo : IGeneratedTypeMetada
{
ImmutableArray enumMembers = enumSymbol.GetMembers ();
IEnumerable fieldSymbols = enumMembers.OfType ();
- IntMembers = fieldSymbols.Select (static m => m.HasConstantValue ? (int)m.ConstantValue : 0).ToImmutableHashSet ();
+ _intMembers = fieldSymbols.Select (static m => m.HasConstantValue ? (int)m.ConstantValue : 0).ToImmutableHashSet ();
}
private void PopulateUIntMembersHashSet (INamedTypeSymbol enumSymbol)
{
- UIntMembers = enumSymbol.GetMembers ().OfType ().Select (static m => (uint)m.ConstantValue).ToImmutableHashSet ();
+ _uIntMembers = enumSymbol.GetMembers ().OfType ().Select (static m => (uint)m.ConstantValue).ToImmutableHashSet ();
}
private bool HasExplicitFastHasFlags
@@ -328,18 +326,6 @@ internal sealed record EnumExtensionMethodsGenerationInfo : IGeneratedTypeMetada
set => _discoveredProperties [ExplicitFastIsDefinedMask] = value;
}
- private bool HasExplicitIncludeInterface
- {
- [UsedImplicitly]get => _discoveredProperties [ExplicitIncludeInterfaceMask];
- set => _discoveredProperties [ExplicitIncludeInterfaceMask] = value;
- }
-
- private bool HasExplicitPartial
- {
- [UsedImplicitly]get => _discoveredProperties [ExplicitPartialMask];
- set => _discoveredProperties [ExplicitPartialMask] = value;
- }
-
private bool HasExplicitTypeName
{
get => _discoveredProperties [ExplicitNameMask];
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsIncrementalGenerator.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsIncrementalGenerator.cs
index 66bfd3e81..7629fd8c2 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsIncrementalGenerator.cs
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumExtensionMethodsIncrementalGenerator.cs
@@ -22,7 +22,7 @@ public sealed class EnumExtensionMethodsIncrementalGenerator : IIncrementalGener
private const string GeneratorAttributeName = nameof (GenerateEnumExtensionMethodsAttribute);
/// Fully-qualified symbol name format without the "global::" prefix.
- private static readonly SymbolDisplayFormat FullyQualifiedSymbolDisplayFormatWithoutGlobal =
+ private static readonly SymbolDisplayFormat _fullyQualifiedSymbolDisplayFormatWithoutGlobal =
SymbolDisplayFormat.FullyQualifiedFormat.WithGlobalNamespaceStyle (SymbolDisplayGlobalNamespaceStyle.Omitted);
///
@@ -160,7 +160,7 @@ public sealed class EnumExtensionMethodsIncrementalGenerator : IIncrementalGener
string enumName = namedSymbol.Name;
- string enumNamespace = enumNamespaceSymbol.ToDisplayString (FullyQualifiedSymbolDisplayFormatWithoutGlobal);
+ string enumNamespace = enumNamespaceSymbol.ToDisplayString (_fullyQualifiedSymbolDisplayFormatWithoutGlobal);
TypeCode enumTypeCode = namedSymbol.EnumUnderlyingType.Name switch
{
@@ -260,8 +260,8 @@ public sealed class EnumExtensionMethodsIncrementalGenerator : IIncrementalGener
/// Used to enable source generation of a common set of extension methods for enum types.
///
{{Strings.Templates.AttributesForGeneratedTypes}}
- [System.AttributeUsageAttribute (System.AttributeTargets.Enum)]
- public sealed class {{GeneratorAttributeName}} : Attribute
+ [{{Strings.DotnetNames.Types.AttributeUsageAttribute}} ({{Strings.DotnetNames.Types.AttributeTargets}}.Enum)]
+ public sealed class {{GeneratorAttributeName}} : {{Strings.DotnetNames.Types.Attribute}}
{
///
/// The name of the generated static class.
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumMemberCombinationsGenerator.cs b/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumMemberCombinationsGenerator.cs
deleted file mode 100644
index 82753d078..000000000
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Generators/EnumExtensions/EnumMemberCombinationsGenerator.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-using System.Text;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Text;
-using Terminal.Gui.Analyzers.Internal.Attributes;
-using Terminal.Gui.Analyzers.Internal.Constants;
-
-namespace Terminal.Gui.Analyzers.Internal.Generators.EnumExtensions;
-
-///
-/// Implementation of for types decorated with .
-///
-[Generator]
-internal sealed class EnumMemberCombinationsGenerator : IIncrementalGenerator
-{
- private const string AttributeCodeText = $$"""
- {{Strings.Templates.StandardHeader}}
-
- namespace {{Strings.AnalyzersAttributesNamespace}};
-
- ///
- /// Designates an enum member for inclusion in generation of bitwise combinations with other members decorated with
- /// this attribute which have the same value.
- ///
- ///
- ///
- /// This attribute is only considered for enum types with the .
- ///
- ///
- /// Masks with more than 8 bits set will
- ///
- ///
- [AttributeUsageAttribute(AttributeTargets.Enum)]
- internal sealed class {{nameof (GenerateEnumMemberCombinationsAttribute)}} : System.Attribute
- {
- public const byte MaximumPopCountLimit = 14;
- private uint _mask;
- private uint _maskPopCount;
- private byte _popCountLimit = 8;
- public required string GroupTag { get; set; }
-
- public required uint Mask
- {
- get => _mask;
- set
- {
- _maskPopCount = uint.PopCount(value);
-
- PopCountLimitExceeded = _maskPopCount > PopCountLimit;
- MaximumPopCountLimitExceeded = _maskPopCount > MaximumPopCountLimit;
-
- if (PopCountLimitExceeded || MaximumPopCountLimitExceeded)
- {
- return;
- }
-
- _mask = value;
- }
- }
-
- ///
- /// The maximum number of bits allowed to be set to 1 in .
- ///
- ///
- ///
- /// Default: 8 (256 possible combinations)
- ///
- ///
- /// Increasing this value is not recommended!
- /// Decreasing this value is pointless unless you want to limit maximum possible generated combinations even
- /// further.
- ///
- ///
- /// If the result of () exceeds 2 ^ , no
- /// combinations will be generated for the members which otherwise would have been included by .
- /// Values exceeding the actual population count of have no effect.
- ///
- ///
- /// This option is set to a sane default of 8, but also has a hard-coded limit of 14 (16384 combinations), as a
- /// protection against generation of extremely large files.
- ///
- ///
- /// CAUTION: The maximum number of possible combinations possible is equal to 1 <<
- /// ().
- /// See for hard-coded limit,
- ///
- ///
- public byte PopCountLimit
- {
- get => _popCountLimit;
- set
- {
- _maskPopCount = uint.PopCount(_mask);
-
- PopCountLimitExceeded = _maskPopCount > value;
- MaximumPopCountLimitExceeded = _maskPopCount > MaximumPopCountLimit;
-
- if (PopCountLimitExceeded || MaximumPopCountLimitExceeded)
- {
- return;
- }
-
- _mask = value;
- _popCountLimit = value;
- }
- }
-
- internal bool MaximumPopCountLimitExceeded { get; private set; }
- internal bool PopCountLimitExceeded { get; private set; }
- }
-
- """;
-
- private const string AttributeFullyQualifiedName = $"{Strings.AnalyzersAttributesNamespace}.{AttributeName}";
- private const string AttributeName = "GenerateEnumMemberCombinationsAttribute";
-
- ///
- public void Initialize (IncrementalGeneratorInitializationContext context)
- {
- context.RegisterPostInitializationOutput (GenerateAttributeCode);
-
- return;
-
- static void GenerateAttributeCode (IncrementalGeneratorPostInitializationContext initContext)
- {
-#pragma warning disable IDE0061 // Use expression body for local function
- initContext.AddSource ($"{AttributeFullyQualifiedName}.g.cs", SourceText.From (AttributeCodeText, Encoding.UTF8));
-#pragma warning restore IDE0061 // Use expression body for local function
- }
- }
-}
diff --git a/Analyzers/Terminal.Gui.Analyzers.Internal/Terminal.Gui.Analyzers.Internal.csproj b/Analyzers/Terminal.Gui.Analyzers.Internal/Terminal.Gui.Analyzers.Internal.csproj
index 1b7ecaf9b..3dcd5bc48 100644
--- a/Analyzers/Terminal.Gui.Analyzers.Internal/Terminal.Gui.Analyzers.Internal.csproj
+++ b/Analyzers/Terminal.Gui.Analyzers.Internal/Terminal.Gui.Analyzers.Internal.csproj
@@ -1,9 +1,9 @@
netstandard2.0
@@ -11,21 +11,14 @@
Library
12
- enable
Terminal.Gui.Analyzers.Internal
disable
true
true
True
- latest-recommended
- 7
- UTF-8
true
- true
true
- true
true
- $(DefineConstants);JETBRAINS_ANNOTATIONS;CONTRACTS_FULL;CODE_ANALYSIS
True
true
true
@@ -39,33 +32,13 @@
-
-
-
-
- $(NoWarn);nullable;CA1067
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ $(NoWarn);nullable;CA1067
+
+
+
-
@@ -74,25 +47,17 @@
+
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
diff --git a/Scripts/Terminal.Gui.PowerShell.Analyzers.psm1 b/Scripts/Terminal.Gui.PowerShell.Analyzers.psm1
index 78a87a448..8e3a8dc58 100644
--- a/Scripts/Terminal.Gui.PowerShell.Analyzers.psm1
+++ b/Scripts/Terminal.Gui.PowerShell.Analyzers.psm1
@@ -55,43 +55,34 @@ Function Build-Analyzers {
return
}
- New-Variable -Name solutionRoot -Visibility Public -Value (Resolve-Path ..)
- Push-Location $solutionRoot
- New-Variable -Name solutionFile -Visibility Public -Value (Resolve-Path ./Terminal.sln)
- $mainProjectRoot = Resolve-Path ./Terminal.Gui
- $mainProjectFile = Join-Path $mainProjectRoot Terminal.Gui.csproj
- $analyzersRoot = Resolve-Path ./Analyzers
- $internalAnalyzersProjectRoot = Join-Path $analyzersRoot Terminal.Gui.Analyzers.Internal
- $internalAnalyzersProjectFile = Join-Path $internalAnalyzersProjectRoot Terminal.Gui.Analyzers.Internal.csproj
+ Push-Location $InternalAnalyzersProjectDirectory
if(!$NoClean) {
if(!$Quiet) {
Write-Host Deleting bin and obj folders for Terminal.Gui
}
- if(Test-Path $mainProjectRoot/bin) {
- Remove-Item -Recurse -Force $mainProjectRoot/bin
- Remove-Item -Recurse -Force $mainProjectRoot/obj
- }
+ Remove-Item -Recurse -Force $TerminalGuiProjectDirectory/bin -ErrorAction SilentlyContinue
+ Remove-Item -Recurse -Force $TerminalGuiProjectDirectory/obj -ErrorAction SilentlyContinue
if(!$Quiet) {
Write-Host Deleting bin and obj folders for Terminal.Gui.InternalAnalyzers
}
- if(Test-Path $internalAnalyzersProjectRoot/bin) {
- Remove-Item -Recurse -Force $internalAnalyzersProjectRoot/bin
- Remove-Item -Recurse -Force $internalAnalyzersProjectRoot/obj
- }
+ Remove-Item -Recurse -Force $InternalAnalyzersProjectDirectory/bin -ErrorAction SilentlyContinue
+ Remove-Item -Recurse -Force $InternalAnalyzersProjectDirectory/obj -ErrorAction SilentlyContinue
}
if(!$Quiet) {
Write-Host Building analyzers in Debug configuration
}
- dotnet build $internalAnalyzersProjectFile --no-incremental --nologo --force --configuration Debug
+ dotnet build $InternalAnalyzersProjectFilePath --no-incremental --nologo --force --configuration Debug
if(!$Quiet) {
Write-Host Building analyzers in Release configuration
}
- dotnet build $internalAnalyzersProjectFile --no-incremental --nologo --force --configuration Release
+ dotnet build $InternalAnalyzersProjectFilePath --no-incremental --nologo --force --configuration Release
+ Pop-Location
+
if(!$AutoLaunch) {
Write-Host -ForegroundColor Green Finished. Restart Visual Studio for changes to take effect.
} else {
@@ -102,4 +93,4 @@ Function Build-Analyzers {
}
return
-}
\ No newline at end of file
+}
diff --git a/Scripts/Terminal.Gui.PowerShell.Core.psm1 b/Scripts/Terminal.Gui.PowerShell.Core.psm1
index 1c1574e74..6ef11baed 100644
--- a/Scripts/Terminal.Gui.PowerShell.Core.psm1
+++ b/Scripts/Terminal.Gui.PowerShell.Core.psm1
@@ -14,17 +14,18 @@ Function Open-Solution {
[CmdletBinding()]
param(
[Parameter(Mandatory=$false, HelpMessage="The path to the solution file to open.")]
- [Uri]$SolutionFilePath = (Resolve-Path "../Terminal.sln")
+ [ValidatePattern(".*Terminal\.sln" )]
+ [string]$Path = $SolutionFilePath
)
if(!$IsWindows) {
[string]$warningMessage = "The Open-Solution cmdlet is only supported on Windows.`n`
- Attempt to open file $SolutionFilePath with the system default handler?"
+ Attempt to open file $Path with the system default handler?"
Write-Warning $warningMessage -WarningAction Inquire
}
- Invoke-Item $SolutionFilePath
+ Invoke-Item $Path
return
}
@@ -62,6 +63,16 @@ Function Set-PowerShellEnvironment {
[CmdletBinding()]
param()
+ # Set up some common globals
+ New-Variable -Name ScriptsDirectory -Value $PSScriptRoot -Option ReadOnly -Scope Global -Visibility Public
+ New-Variable -Name RepositoryRootDirectory -Value (Join-Path -Resolve $ScriptsDirectory "..") -Option ReadOnly -Scope Global -Visibility Public
+ New-Variable -Name SolutionFilePath -Value (Join-Path -Resolve $RepositoryRootDirectory "Terminal.sln") -Option ReadOnly -Scope Global -Visibility Public
+ New-Variable -Name TerminalGuiProjectDirectory -Value (Join-Path -Resolve $RepositoryRootDirectory "Terminal.Gui") -Option ReadOnly -Scope Global -Visibility Public
+ New-Variable -Name TerminalGuiProjectFilePath -Value (Join-Path -Resolve $TerminalGuiProjectDirectory "Terminal.Gui.csproj") -Option ReadOnly -Scope Global -Visibility Public
+ New-Variable -Name AnalyzersDirectory -Value (Join-Path -Resolve $RepositoryRootDirectory "Analyzers") -Option ReadOnly -Scope Global -Visibility Public
+ New-Variable -Name InternalAnalyzersProjectDirectory -Value (Join-Path -Resolve $AnalyzersDirectory "Terminal.Gui.Analyzers.Internal") -Option ReadOnly -Scope Global -Visibility Public
+ New-Variable -Name InternalAnalyzersProjectFilePath -Value (Join-Path -Resolve $InternalAnalyzersProjectDirectory "Terminal.Gui.Analyzers.Internal.csproj") -Option ReadOnly -Scope Global -Visibility Public
+
# Set a custom prompt to indicate we're in our modified environment.
# Save the normal one first, though.
# And save it as ReadOnly and without the -Force parameter, so this will be skipped if run more than once in the same session without a reset.
@@ -132,6 +143,14 @@ Function Reset-PowerShellEnvironment {
}
Remove-Variable -Name PathVarSeparator -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name RepositoryRootDirectory -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name SolutionFilePath -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name TerminalGuiProjectDirectory -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name TerminalGuiProjectFilePath -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name ScriptsDirectory -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name AnalyzersDirectory -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name InternalAnalyzersProjectDirectory -Scope Global -Force -ErrorAction SilentlyContinue
+ Remove-Variable -Name InternalAnalyzersProjectFilePath -Scope Global -Force -ErrorAction SilentlyContinue
}
# This ensures the environment is reset when unloading the module.
@@ -140,4 +159,4 @@ $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
Reset-PowerShellEnvironment
}
-Set-PowerShellEnvironment
\ No newline at end of file
+Set-PowerShellEnvironment
diff --git a/Terminal.Gui/Terminal.Gui.csproj b/Terminal.Gui/Terminal.Gui.csproj
index 3c909c250..f0840c041 100644
--- a/Terminal.Gui/Terminal.Gui.csproj
+++ b/Terminal.Gui/Terminal.Gui.csproj
@@ -1,4 +1,4 @@
-
+
@@ -18,7 +18,7 @@
true
True
portable
- $(DefineConstants);JETBRAINS_ANNOTATIONS;CONTRACTS_FULL
+ $(DefineConstants);JETBRAINS_ANNOTATIONS;CONTRACTS_FULL;CODE_ANALYSIS
enable
True
true
@@ -45,19 +45,27 @@
-
+
+
+
+
+
+ all
+ Analyzer
+ false
+
-
+
diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs
index 585929e99..0829e961d 100644
--- a/Terminal.Gui/View/Adornment/Adornment.cs
+++ b/Terminal.Gui/View/Adornment/Adornment.cs
@@ -244,7 +244,7 @@ public class Adornment : View
protected internal override bool OnMouseLeave (MouseEvent mouseEvent)
{
// Invert Normal
- if (Diagnostics.HasFlag (ViewDiagnosticFlags.MouseEnter) && ColorScheme != null)
+ if (Diagnostics.FastHasFlags (ViewDiagnosticFlags.MouseEnter) && ColorScheme != null)
{
var cs = new ColorScheme (ColorScheme)
{
diff --git a/Terminal.Gui/View/ViewDiagnostics.cs b/Terminal.Gui/View/ViewDiagnostics.cs
index dbaba3b53..20899cfd0 100644
--- a/Terminal.Gui/View/ViewDiagnostics.cs
+++ b/Terminal.Gui/View/ViewDiagnostics.cs
@@ -1,8 +1,11 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
namespace Terminal.Gui;
/// Enables diagnostic functions for .
[Flags]
+[GenerateEnumExtensionMethods(FastHasFlags = true)]
public enum ViewDiagnosticFlags : uint
{
/// All diagnostics off
diff --git a/Terminal.sln b/Terminal.sln
index 8f06e5fd6..98de83b41 100644
--- a/Terminal.sln
+++ b/Terminal.sln
@@ -30,54 +30,57 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
testenvironments.json = testenvironments.json
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzers", "Analyzers", "{CCADA0BC-61CF-4B4B-96BA-A3B0C0A7F54D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Terminal.Gui.Analyzers.Internal", "Analyzers\Terminal.Gui.Analyzers.Internal\Terminal.Gui.Analyzers.Internal.csproj", "{5DE91722-8765-4E2B-97E4-2A18010B5CED}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Terminal.Gui.Analyzers.Internal.Tests", "Analyzers\Terminal.Gui.Analyzers.Internal.Tests\Terminal.Gui.Analyzers.Internal.Tests.csproj", "{715DB4BA-F989-4DF6-B46F-5ED26A32B2DD}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Terminal.Gui.Analyzers.Internal.Debugging", "Analyzers\Terminal.Gui.Analyzers.Internal.Debugging\Terminal.Gui.Analyzers.Internal.Debugging.csproj", "{C2AD09BD-D579-45A7-ACA3-E4EF3BC027D2}"
+EndProject
Global
+ GlobalSection(NestedProjects) = preSolution
+ {5DE91722-8765-4E2B-97E4-2A18010B5CED} = {CCADA0BC-61CF-4B4B-96BA-A3B0C0A7F54D}
+ {715DB4BA-F989-4DF6-B46F-5ED26A32B2DD} = {CCADA0BC-61CF-4B4B-96BA-A3B0C0A7F54D}
+ {C2AD09BD-D579-45A7-ACA3-E4EF3BC027D2} = {CCADA0BC-61CF-4B4B-96BA-A3B0C0A7F54D}
+ EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
- Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
- Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Debug|x86.Build.0 = Debug|Any CPU
{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Release|Any CPU.Build.0 = Release|Any CPU
- {00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Release|x86.ActiveCfg = Release|Any CPU
- {00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Release|x86.Build.0 = Release|Any CPU
+ {5DE91722-8765-4E2B-97E4-2A18010B5CED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5DE91722-8765-4E2B-97E4-2A18010B5CED}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5DE91722-8765-4E2B-97E4-2A18010B5CED}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5DE91722-8765-4E2B-97E4-2A18010B5CED}.Release|Any CPU.Build.0 = Release|Any CPU
+ {715DB4BA-F989-4DF6-B46F-5ED26A32B2DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {715DB4BA-F989-4DF6-B46F-5ED26A32B2DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {715DB4BA-F989-4DF6-B46F-5ED26A32B2DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {715DB4BA-F989-4DF6-B46F-5ED26A32B2DD}.Release|Any CPU.Build.0 = Release|Any CPU
{88979F89-9A42-448F-AE3E-3060145F6375}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88979F89-9A42-448F-AE3E-3060145F6375}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {88979F89-9A42-448F-AE3E-3060145F6375}.Debug|x86.ActiveCfg = Debug|Any CPU
- {88979F89-9A42-448F-AE3E-3060145F6375}.Debug|x86.Build.0 = Debug|Any CPU
{88979F89-9A42-448F-AE3E-3060145F6375}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88979F89-9A42-448F-AE3E-3060145F6375}.Release|Any CPU.Build.0 = Release|Any CPU
- {88979F89-9A42-448F-AE3E-3060145F6375}.Release|x86.ActiveCfg = Release|Any CPU
- {88979F89-9A42-448F-AE3E-3060145F6375}.Release|x86.Build.0 = Release|Any CPU
{8B901EDE-8974-4820-B100-5226917E2990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B901EDE-8974-4820-B100-5226917E2990}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B901EDE-8974-4820-B100-5226917E2990}.Debug|x86.ActiveCfg = Debug|Any CPU
- {8B901EDE-8974-4820-B100-5226917E2990}.Debug|x86.Build.0 = Debug|Any CPU
{8B901EDE-8974-4820-B100-5226917E2990}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B901EDE-8974-4820-B100-5226917E2990}.Release|Any CPU.Build.0 = Release|Any CPU
- {8B901EDE-8974-4820-B100-5226917E2990}.Release|x86.ActiveCfg = Release|Any CPU
- {8B901EDE-8974-4820-B100-5226917E2990}.Release|x86.Build.0 = Release|Any CPU
{44E15B48-0DB2-4560-82BD-D3B7989811C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44E15B48-0DB2-4560-82BD-D3B7989811C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {44E15B48-0DB2-4560-82BD-D3B7989811C3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {44E15B48-0DB2-4560-82BD-D3B7989811C3}.Debug|x86.Build.0 = Debug|Any CPU
{44E15B48-0DB2-4560-82BD-D3B7989811C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44E15B48-0DB2-4560-82BD-D3B7989811C3}.Release|Any CPU.Build.0 = Release|Any CPU
- {44E15B48-0DB2-4560-82BD-D3B7989811C3}.Release|x86.ActiveCfg = Release|Any CPU
- {44E15B48-0DB2-4560-82BD-D3B7989811C3}.Release|x86.Build.0 = Release|Any CPU
{B0A602CD-E176-449D-8663-64238D54F857}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0A602CD-E176-449D-8663-64238D54F857}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B0A602CD-E176-449D-8663-64238D54F857}.Debug|x86.ActiveCfg = Debug|Any CPU
- {B0A602CD-E176-449D-8663-64238D54F857}.Debug|x86.Build.0 = Debug|Any CPU
{B0A602CD-E176-449D-8663-64238D54F857}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0A602CD-E176-449D-8663-64238D54F857}.Release|Any CPU.Build.0 = Release|Any CPU
- {B0A602CD-E176-449D-8663-64238D54F857}.Release|x86.ActiveCfg = Release|Any CPU
- {B0A602CD-E176-449D-8663-64238D54F857}.Release|x86.Build.0 = Release|Any CPU
+ {C2AD09BD-D579-45A7-ACA3-E4EF3BC027D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C2AD09BD-D579-45A7-ACA3-E4EF3BC027D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C2AD09BD-D579-45A7-ACA3-E4EF3BC027D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C2AD09BD-D579-45A7-ACA3-E4EF3BC027D2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -85,34 +88,4 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9F8F8A4D-7B8D-4C2A-AC5E-CD7117F74C03}
EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- Policies = $0
- $0.TextStylePolicy = $1
- $1.FileWidth = 80
- $1.scope = text/x-csharp
- $1.TabWidth = 8
- $1.IndentWidth = 8
- $0.CSharpFormattingPolicy = $2
- $2.scope = text/x-csharp
- $2.IndentSwitchSection = False
- $2.NewLinesForBracesInTypes = False
- $2.NewLinesForBracesInProperties = False
- $2.NewLinesForBracesInAccessors = False
- $2.NewLinesForBracesInAnonymousMethods = False
- $2.NewLinesForBracesInControlBlocks = False
- $2.NewLinesForBracesInAnonymousTypes = False
- $2.NewLinesForBracesInObjectCollectionArrayInitializers = False
- $2.NewLinesForBracesInLambdaExpressionBody = False
- $2.NewLineForElse = False
- $2.NewLineForCatch = False
- $2.NewLineForFinally = False
- $2.NewLineForMembersInObjectInit = False
- $2.NewLineForMembersInAnonymousTypes = False
- $2.NewLineForClausesInQuery = False
- $2.SpacingAfterMethodDeclarationName = True
- $2.SpaceAfterMethodCallName = True
- $2.SpaceBeforeOpenSquareBracket = True
- $0.DotNetNamingPolicy = $3
- $0.StandardHeader = $4
- EndGlobalSection
EndGlobal