Skip to content

feat: add support for !ignore tag#17

Merged
ryodine merged 7 commits intomainfrom
feat/ignore
Mar 15, 2026
Merged

feat: add support for !ignore tag#17
ryodine merged 7 commits intomainfrom
feat/ignore

Conversation

@ryodine
Copy link
Copy Markdown
Collaborator

@ryodine ryodine commented Mar 8, 2026

Implements !ignore tag as specified in dsillman2000/yaml-reference-specs#27

@ryodine ryodine self-assigned this Mar 8, 2026
@ryodine ryodine marked this pull request as ready for review March 8, 2026 20:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for the YAML !ignore tag, matching the referenced spec, so ignored nodes/documents are erased from parsed output while still allowing anchor extraction when requested.

Changes:

  • Introduces !ignore custom YAML tag handling and JS post-processing to drop ignored nodes (maps, seqs, scalars, and root documents).
  • Updates resolver semantics to treat top-level ignored documents as null on load, and to omit ignored files from !reference-all.
  • Adds a comprehensive Jest test suite covering parser + resolver behavior for !ignore.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/ignore.test.ts New end-to-end tests validating parser/resolver behavior for !ignore, including anchor/alias interactions.
src/Ignore.ts Implements YAML custom tags and runtime markers for !ignore nodes.
src/parser.ts Registers !ignore tags and drops ignored nodes during processParsedDocument.
src/resolver.ts Treats top-level ignored docs as null on async load and skips undefined entries in !reference-all results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 167 to +170
const parsed = await parseYamlWithReferences(filePath);
if (parsed === undefined || parsed === null) {
return null;
}
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadAndResolve now coerces a top-level parsed undefined (from !ignore) to null, but loadAndResolveSync does not. This makes loadYamlWithReferences and loadYamlWithReferencesSync behave differently for the same !ignore document (async returns null, sync returns undefined). Align the sync implementation (e.g., early-return null for undefined/null parsed roots) so the public API is consistent across async/sync variants.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Copy Markdown

Copilot AI commented Mar 8, 2026

@ryodine I've opened a new pull request, #18, to work on those changes. Once the pull request is ready, I'll request review from you.

…ents (#18)

* Initial plan

* Align loadAndResolveSync with loadAndResolve for !ignore top-level null/undefined

Co-authored-by: ryodine <5068378+ryodine@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ryodine <5068378+ryodine@users.noreply.github.com>
@ryodine ryodine requested a review from dsillman2000 March 8, 2026 21:06
@ryodine ryodine added the enhancement New feature or request label Mar 8, 2026
Copy link
Copy Markdown
Owner

@dsillman2000 dsillman2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ryodine ryodine merged commit 9f1f532 into main Mar 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants