From 05f4a181f8885645e8d58036d7d1e4069d17350f Mon Sep 17 00:00:00 2001 From: WMJ Date: Thu, 21 Mar 2019 14:19:31 +0800 Subject: [PATCH] ! Removed "abstract" from modifiers of interfaces --- Codist/Controls/ThemedText.cs | 2 +- Codist/Helpers/CodeAnalysisHelper.Symbol.cs | 2 +- Codist/QuickInfo/CSharpQuickInfo.cs | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Codist/Controls/ThemedText.cs b/Codist/Controls/ThemedText.cs index 5a138b26..c05df98e 100644 --- a/Codist/Controls/ThemedText.cs +++ b/Codist/Controls/ThemedText.cs @@ -84,7 +84,7 @@ public ThemedTipParagraph(int iconId) : this(iconId, null) { public ThemedTipParagraph(TextBlock content) : this(0, content) { } public Image Icon => Children[0] as Image; - public TextBlock Content { get; private set; } + public TextBlock Content { get; } } sealed class ThemedToolBarText : TextBlock { diff --git a/Codist/Helpers/CodeAnalysisHelper.Symbol.cs b/Codist/Helpers/CodeAnalysisHelper.Symbol.cs index 3c17cc0c..b44fe327 100644 --- a/Codist/Helpers/CodeAnalysisHelper.Symbol.cs +++ b/Codist/Helpers/CodeAnalysisHelper.Symbol.cs @@ -261,7 +261,7 @@ public static string GetAssemblyModuleName(this ISymbol symbol) { #region Symbol information public static string GetAbstractionModifier(this ISymbol symbol) { - if (symbol.IsAbstract) { + if (symbol.IsAbstract && (symbol.Kind != SymbolKind.NamedType || (symbol as INamedTypeSymbol).TypeKind != TypeKind.Interface)) { return "abstract "; } else if (symbol.IsStatic) { diff --git a/Codist/QuickInfo/CSharpQuickInfo.cs b/Codist/QuickInfo/CSharpQuickInfo.cs index aaf8b0cd..8ac7150d 100644 --- a/Codist/QuickInfo/CSharpQuickInfo.cs +++ b/Codist/QuickInfo/CSharpQuickInfo.cs @@ -313,7 +313,6 @@ void OverrideDocumentation(SyntaxNode node, IQuickInfoOverrider qiWrapper, ISymb if (Config.Instance.QuickInfoOptions.MatchFlags(QuickInfoOptions.ExceptionDoc) && (symbol.Kind == SymbolKind.Method || symbol.Kind == SymbolKind.Property || symbol.Kind == SymbolKind.Event) && doc.Exceptions != null) { - var exceptions = doc.Exceptions; var p = new ThemedTipParagraph(KnownImageIds.StatusInvalidOutline, new ThemedTipText("Exception:", true)); foreach (var ex in doc.Exceptions) { var et = ex.Attribute("cref"); @@ -375,7 +374,7 @@ void ShowSymbolInfo(IList qiContent, SyntaxNode node, ISymbol symbol) { if (Config.Instance.QuickInfoOptions.MatchFlags(QuickInfoOptions.Attributes)) { ShowAttributesInfo(qiContent, symbol.ContainingType); } - ShowTypeInfo(qiContent, node.Parent, symbol.ContainingType as INamedTypeSymbol); + ShowTypeInfo(qiContent, node.Parent, symbol.ContainingType); } if (Config.Instance.QuickInfoOptions.MatchFlags(QuickInfoOptions.Color) && m.ContainingType.Name == "Color") { var preview = ColorQuickInfo.PreviewColorMethodInvocation(_SemanticModel, node, symbol as IMethodSymbol); @@ -688,7 +687,7 @@ static void ShowConstInfo(IList qiContent, ISymbol symbol, object value) static void ShowInterfaceImplementation(IList qiContent, TSymbol symbol, IEnumerable explicitImplementations) where TSymbol : class, ISymbol { - if (symbol.IsStatic || symbol.DeclaredAccessibility != Accessibility.Public && explicitImplementations.FirstOrDefault() == null) { + if (symbol.IsStatic || symbol.DeclaredAccessibility != Accessibility.Public && explicitImplementations.Any() == false) { return; } var interfaces = symbol.ContainingType.AllInterfaces; @@ -946,7 +945,7 @@ static void ShowEnumInfo(IList qiContent, INamedTypeSymbol type, bool fr .Append(max.ToString() + "(") .Append(maxName.Name, _SymbolFormatter.Enum) .Append(")"); - if (type.GetAttributes().FirstOrDefault(a => a.AttributeClass.ToDisplayString() == "System.FlagsAttribute") != null) { + if (type.GetAttributes().Any(a => a.AttributeClass.ToDisplayString() == "System.FlagsAttribute")) { var d = Convert.ToString(Convert.ToInt64(bits), 2); content.AppendLine().Append("All flags: ", true) .Append(d) @@ -1173,11 +1172,10 @@ static string ToHexString(byte[] bytes) { } static StackPanel ShowNumericForms(string dec, byte[] bytes) { - var s = new StackPanel() + return new StackPanel() .Add(new StackPanel().MakeHorizontal().AddReadOnlyTextBox(dec).Add(new ThemedTipText(" DEC", true))) .Add(new StackPanel().MakeHorizontal().AddReadOnlyTextBox(ToHexString(bytes)).Add(new ThemedTipText(" HEX", true))) .Add(new StackPanel().MakeHorizontal().AddReadOnlyTextBox(ToBinString(bytes)).Add(new ThemedTipText(" BIN", true))); - return s; } static TextBlock ToUIText(ISymbol symbol) {