Fixed DebuggerDisplay in DefaultTagHelperContent
- Also refactored it in few other places
This commit is contained in:
parent
31e9710186
commit
ce689b0449
|
|
@ -8,7 +8,6 @@ using System.Linq;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language
|
namespace Microsoft.AspNetCore.Razor.Language
|
||||||
{
|
{
|
||||||
[DebuggerDisplay("{DisplayName,nq}")]
|
|
||||||
public abstract class AllowedChildTagDescriptor : IEquatable<AllowedChildTagDescriptor>
|
public abstract class AllowedChildTagDescriptor : IEquatable<AllowedChildTagDescriptor>
|
||||||
{
|
{
|
||||||
public string Name { get; protected set; }
|
public string Name { get; protected set; }
|
||||||
|
|
@ -27,6 +26,11 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return DisplayName ?? base.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public bool Equals(AllowedChildTagDescriptor other)
|
public bool Equals(AllowedChildTagDescriptor other)
|
||||||
{
|
{
|
||||||
return AllowedChildTagDescriptorComparer.Default.Equals(this, other);
|
return AllowedChildTagDescriptorComparer.Default.Equals(this, other);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language
|
namespace Microsoft.AspNetCore.Razor.Language
|
||||||
|
|
@ -11,7 +10,6 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A metadata class describing a tag helper attribute.
|
/// A metadata class describing a tag helper attribute.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DebuggerDisplay("{DisplayName,nq}")]
|
|
||||||
public abstract class BoundAttributeDescriptor : IEquatable<BoundAttributeDescriptor>
|
public abstract class BoundAttributeDescriptor : IEquatable<BoundAttributeDescriptor>
|
||||||
{
|
{
|
||||||
protected BoundAttributeDescriptor(string kind)
|
protected BoundAttributeDescriptor(string kind)
|
||||||
|
|
@ -55,6 +53,11 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return DisplayName ?? base.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public bool Equals(BoundAttributeDescriptor other)
|
public bool Equals(BoundAttributeDescriptor other)
|
||||||
{
|
{
|
||||||
return BoundAttributeDescriptorComparer.Default.Equals(this, other);
|
return BoundAttributeDescriptorComparer.Default.Equals(this, other);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
{
|
{
|
||||||
[DebuggerDisplay("({Location})\"{Value}\"")]
|
[DebuggerDisplay("{" + nameof(DebuggerToString) + "(),nq}")]
|
||||||
internal class LocationTagged<TValue> : IFormattable
|
internal class LocationTagged<TValue> : IFormattable
|
||||||
{
|
{
|
||||||
public LocationTagged(TValue value, int absoluteIndex, int lineIndex, int characterIndex)
|
public LocationTagged(TValue value, int absoluteIndex, int lineIndex, int characterIndex)
|
||||||
|
|
@ -80,5 +80,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
{
|
{
|
||||||
return value == null ? default(TValue) : value.Value;
|
return value == null ? default(TValue) : value.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string DebuggerToString()
|
||||||
|
{
|
||||||
|
return $@"({Location})""{Value}""";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
// Debug Helpers
|
// Debug Helpers
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
[DebuggerDisplay("{Unparsed}")]
|
[DebuggerDisplay("{" + nameof(DebuggerToString) + "(),nq}")]
|
||||||
internal partial class ParserContext
|
internal partial class ParserContext
|
||||||
{
|
{
|
||||||
private const int InfiniteLoopCountThreshold = 1000;
|
private const int InfiniteLoopCountThreshold = 1000;
|
||||||
|
|
@ -98,6 +98,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
||||||
_infiniteLoopGuardLocation = Source.Location;
|
_infiniteLoopGuardLocation = Source.Location;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string DebuggerToString()
|
||||||
|
{
|
||||||
|
return Unparsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language
|
namespace Microsoft.AspNetCore.Razor.Language
|
||||||
{
|
{
|
||||||
[DebuggerDisplay("Error {Id}: {GetMessageFormat()}")]
|
[DebuggerDisplay("{" + nameof(DebuggerToString) + "(),nq}")]
|
||||||
public sealed class RazorDiagnosticDescriptor : IEquatable<RazorDiagnosticDescriptor>
|
public sealed class RazorDiagnosticDescriptor : IEquatable<RazorDiagnosticDescriptor>
|
||||||
{
|
{
|
||||||
private readonly Func<string> _messageFormat;
|
private readonly Func<string> _messageFormat;
|
||||||
|
|
@ -56,5 +56,10 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
{
|
{
|
||||||
return StringComparer.Ordinal.GetHashCode(Id);
|
return StringComparer.Ordinal.GetHashCode(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string DebuggerToString()
|
||||||
|
{
|
||||||
|
return $@"Error ""{Id}"": ""{GetMessageFormat()}""";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An item in <see cref="RazorProject"/>.
|
/// An item in <see cref="RazorProject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DebuggerDisplay("{CombinedPath}")]
|
[DebuggerDisplay("{" + nameof(DebuggerToString) + "()}")]
|
||||||
public abstract class RazorProjectItem
|
public abstract class RazorProjectItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -105,5 +105,10 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string DebuggerToString()
|
||||||
|
{
|
||||||
|
return CombinedPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,12 +3,10 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language
|
namespace Microsoft.AspNetCore.Razor.Language
|
||||||
{
|
{
|
||||||
[DebuggerDisplay("{DisplayName,nq}")]
|
|
||||||
public abstract class RequiredAttributeDescriptor : IEquatable<RequiredAttributeDescriptor>
|
public abstract class RequiredAttributeDescriptor : IEquatable<RequiredAttributeDescriptor>
|
||||||
{
|
{
|
||||||
public string Name { get; protected set; }
|
public string Name { get; protected set; }
|
||||||
|
|
@ -33,6 +31,11 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return DisplayName ?? base.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public bool Equals(RequiredAttributeDescriptor other)
|
public bool Equals(RequiredAttributeDescriptor other)
|
||||||
{
|
{
|
||||||
return RequiredAttributeDescriptorComparer.Default.Equals(this, other);
|
return RequiredAttributeDescriptorComparer.Default.Equals(this, other);
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,10 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language
|
namespace Microsoft.AspNetCore.Razor.Language
|
||||||
{
|
{
|
||||||
[DebuggerDisplay("{DisplayName,nq}")]
|
|
||||||
public abstract class TagHelperDescriptor : IEquatable<TagHelperDescriptor>
|
public abstract class TagHelperDescriptor : IEquatable<TagHelperDescriptor>
|
||||||
{
|
{
|
||||||
private IEnumerable<RazorDiagnostic> _allDiagnostics;
|
private IEnumerable<RazorDiagnostic> _allDiagnostics;
|
||||||
|
|
@ -68,6 +66,11 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
return _allDiagnostics;
|
return _allDiagnostics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return DisplayName ?? base.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public bool Equals(TagHelperDescriptor other)
|
public bool Equals(TagHelperDescriptor other)
|
||||||
{
|
{
|
||||||
return TagHelperDescriptorComparer.Default.Equals(this, other);
|
return TagHelperDescriptorComparer.Default.Equals(this, other);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default concrete <see cref="TagHelperContent"/>.
|
/// Default concrete <see cref="TagHelperContent"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DebuggerDisplay("{DebuggerToString(),nq}")]
|
[DebuggerDisplay("{" + nameof(DebuggerToString) + "(),nq}")]
|
||||||
public class DefaultTagHelperContent : TagHelperContent
|
public class DefaultTagHelperContent : TagHelperContent
|
||||||
{
|
{
|
||||||
private object _singleContent;
|
private object _singleContent;
|
||||||
|
|
@ -325,6 +325,11 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string DebuggerToString()
|
||||||
|
{
|
||||||
|
return GetContent();
|
||||||
|
}
|
||||||
|
|
||||||
// Overrides Write(string) to find if the content written is empty/whitespace.
|
// Overrides Write(string) to find if the content written is empty/whitespace.
|
||||||
private class EmptyOrWhiteSpaceWriter : TextWriter
|
private class EmptyOrWhiteSpaceWriter : TextWriter
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue