Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log snippet keys #418

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/MarkdownSnippets/Processing/DirectoryMarkdownProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ void InitNewLine()

public void AddSnippets(List<Snippet> snippets)
{
var stopwatch = Stopwatch.StartNew();
var files = snippets
.Where(x => x.Path != null)
.Select(x => x.Path!)
Expand All @@ -186,13 +185,11 @@ public void AddSnippets(List<Snippet> snippets)
if (files.Any())
{
snippetSourceFiles.AddRange(files);
log($"Added {files.Count} files for snippets");
}

if (snippets.Any())
{
this.snippets.AddRange(snippets);
log($"Added {snippets.Count} snippets ({stopwatch.ElapsedMilliseconds}ms)");
}
}

Expand Down Expand Up @@ -226,6 +223,23 @@ public void Run()
}}");
}

foreach (var group in snippets.GroupBy(x=>x.Path))
{
if (group.Key == null)
{
log("Snippets added with no path");
}
else
{
log($"Snippets extracted from {group.Key}");
}

foreach (var snippet in group)
{
log($"\t{snippet.Key}");
}
}

var stopwatch = Stopwatch.StartNew();
MarkdownProcessor processor = new(
convention,
Expand Down