Skip to content

Comments

Fix: files with _snippets in their name incorrectly treated as snippet-only files#2743

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-build-failure-snippets
Open

Fix: files with _snippets in their name incorrectly treated as snippet-only files#2743
Copilot wants to merge 2 commits intomainfrom
copilot/fix-build-failure-snippets

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Substring matching on "_snippets" caused files like top_snippets.md to be classified as SnippetFile (excluded from normal processing) instead of regular MarkdownFile.

Changes

  • MarkdownFileFactory.cs: Replace relativePath.Contains("_snippets") with path-component-aware check — requires _snippets to be a directory segment, not a substring of a filename
  • IncludeBlock.cs: Same fix for include validation — splits on path separators and checks for exact component match instead of IndexOf("_snippets")
  • MockFileSystemExtensions.cs: Fix test helper's Contains("_snippet") (note: missing trailing s) which had the same over-matching behavior when generating docset YAML TOC entries
// Before — matches top_snippets.md, path/to/top_snippets/file.md, etc.
if (relativePath.Contains("_snippets"))

// After — only matches when _snippets is an actual directory component
if (relativePath.Contains($"{Path.DirectorySeparatorChar}_snippets{Path.DirectorySeparatorChar}")
    || relativePath.StartsWith($"_snippets{Path.DirectorySeparatorChar}"))
Original prompt

This section details on the original issue you should resolve

<issue_title>Build fails when filename contains _snippets</issue_title>
<issue_description>Files with _snippets in the filename (e.g. top_snippets.md) cause build failures, presumably because the build logic treats any path containing _snippets as an include-only snippets directory.

Expected behavior

Only _snippets/ directories should be treated specially, not files that happen to contain _snippets in their name.

Workaround

Rename files to kebab case (e.g. top-snippets.md).

Reference

<agent_instructions>I think the easiest would be to detect the snippets folder using /_snippets </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@reakaleek I guess the easiest would be to change the detection to `/_snippets`

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ining _snippets

Co-authored-by: reakaleek <16325797+reakaleek@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build failure caused by filenames containing _snippets Fix: files with _snippets in their name incorrectly treated as snippet-only files Feb 19, 2026
Copilot AI requested a review from reakaleek February 19, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails when filename contains _snippets

2 participants