Skip to content

Commit

Permalink
Merge pull request #7 from StuffOfInterest/feature-intellisense
Browse files Browse the repository at this point in the history
Patch Intellisense
  • Loading branch information
StuffOfInterest authored May 2, 2021
2 parents 243058a + 1f22733 commit 851e747
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 1 deletion.
7 changes: 7 additions & 0 deletions LogicTagHelpers/CaseTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ namespace LogicTagHelpers
[HtmlTargetElement("case", ParentTag = "switch")]
public class CaseTagHelper : TagHelper
{
/// <summary>
/// Value to compare to the 'switch' statement expression.
/// Block only included when matched.
/// </summary>
public object Value { get; set; }

/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var switchContext = (SwitchContext) context.Items[SwitchContext.ContextKey];
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/DefaultTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace LogicTagHelpers
[HtmlTargetElement("default", ParentTag = "switch")]
public class DefaultTagHelper : TagHelper
{
/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var switchContext = (SwitchContext) context.Items[SwitchContext.ContextKey];
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/DoTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class DoTagHelper : TagHelper
/// </summary>
public Func<bool> Condition { get; set; }

/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
if (Condition == null)
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/ElseTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace LogicTagHelpers
[HtmlTargetElement("else", ParentTag = "if")]
public class ElseTagHelper : TagHelper
{
/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var ifContext = (IfContext) context.Items[IfContext.ContextKey];
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/ForTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class ForTagHelper : TagHelper
/// </summary>
public Action Update { get; set; }

/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
if (Condition == null)
Expand Down
20 changes: 20 additions & 0 deletions LogicTagHelpers/ForeachContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,40 @@ namespace LogicTagHelpers
/// <typeparam name="T">Type of object to iterate over.</typeparam>
public class ForeachContext<T> : IForeachContext
{
/// <summary>
/// Create empty iterator context.
/// Exception will be thrown if context is used without having the collection property set.
/// </summary>
public ForeachContext()
{
}

/// <summary>
/// Create iterator context with collection to iterate across.
/// </summary>
/// <param name="items">Type of object used in collection. Also used for type of item property.</param>
public ForeachContext(IEnumerable<T> items)
{
Collection = items;
}

private IEnumerator<T> _enumerator;

/// <summary>
/// Collection of objects to iterate over using 'foreach' loop.
/// </summary>
public IEnumerable<T> Collection { get; set; }

/// <summary>
/// Single item to present to inner content of 'foreach' loop.
/// </summary>
public T Item { get; set; }

/// <summary>
/// Loads next item into item property.
/// Not intended for direct use.
/// </summary>
/// <returns>Boolean indicating if another item is available.</returns>
public bool LoadNext()
{
var enumerator = _enumerator ??= Collection.GetEnumerator();
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/ForeachTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class ForeachTagHelper : TagHelper
/// </summary>
public IForeachContext Iterator { get; set; }

/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
if (Iterator == null)
Expand Down
5 changes: 5 additions & 0 deletions LogicTagHelpers/IForeachContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
/// </summary>
public interface IForeachContext
{
/// <summary>
/// Loads next item into item property.
/// Not intended for direct use.
/// </summary>
/// <returns>Boolean indicating if another item is available.</returns>
bool LoadNext();
}
}
3 changes: 3 additions & 0 deletions LogicTagHelpers/IfTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class IfTagHelper : TagHelper
/// </summary>
public bool Direct { get; set; }

/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
output.TagName = null;
Expand Down
7 changes: 7 additions & 0 deletions LogicTagHelpers/LogicTagHelperException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ namespace LogicTagHelpers
/// </summary>
public class LogicTagHelperException : Exception
{
/// <summary>
/// Create empty exception instance.
/// </summary>
public LogicTagHelperException()
{
}

/// <summary>
/// Create instance of exception with message.
/// </summary>
/// <param name="message">Message indicating reason for exception.</param>
public LogicTagHelperException(string message) : base(message)
{
}
Expand Down
3 changes: 2 additions & 1 deletion LogicTagHelpers/LogicTagHelpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Authors>Delbert Matlock</Authors>
<Company>Stuff Of Interest</Company>
<Product />
Expand All @@ -19,6 +19,7 @@
<RepositoryUrl>https://github.com/StuffOfInterest/LogicTagHelpers</RepositoryUrl>
<LangVersion>8</LangVersion>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/SwitchTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class SwitchTagHelper : TagHelper
/// </summary>
public object Expression { get; set; }

/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
output.TagName = null;
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/ThenTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace LogicTagHelpers
[HtmlTargetElement("then", ParentTag = "if")]
public class ThenTagHelper : TagHelper
{
/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var ifContext = (IfContext) context.Items[IfContext.ContextKey];
Expand Down
3 changes: 3 additions & 0 deletions LogicTagHelpers/WhileTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class WhileTagHelper : TagHelper
/// </summary>
public Func<bool> Condition { get; set; }

/// <summary>
/// Internal tag helper processing.
/// </summary>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
if (Condition == null)
Expand Down

0 comments on commit 851e747

Please sign in to comment.