Skip to content

[Repo Assist] Make MarkdownRange non-optional in MarkdownSpan and MarkdownParagraph (fixes #742)#1067

Open
github-actions[bot] wants to merge 6 commits intomainfrom
repo-assist/fix-issue-742-non-optional-ranges-05198c9c9736942f
Open

[Repo Assist] Make MarkdownRange non-optional in MarkdownSpan and MarkdownParagraph (fixes #742)#1067
github-actions[bot] wants to merge 6 commits intomainfrom
repo-assist/fix-issue-742-non-optional-ranges-05198c9c9736942f

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 3, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant, in response to a /repo-assist command on issue #742.

Summary

Closes #742

This PR makes the range field non-optional in all MarkdownSpan and MarkdownParagraph discriminated union cases, as requested by @dsyme and originally reported by @artempyanykh.

Previously, every Markdown AST node had range: MarkdownRange option. Now all cases have range: MarkdownRange, with MarkdownRange.zero used as a fallback where no source range is available.

Root Cause

The range field was originally defined as optional throughout the AST. The one place where it became None during parsing was in updateCurrentRange when the line list was empty. This has now been fixed to return MarkdownRange.zero instead.

Changes

  • MarkdownModel.fs – All range: MarkdownRange optionrange: MarkdownRange in MarkdownSpan and MarkdownParagraph DU cases; NoneMarkdownRange.zero in Dsl module
  • MarkdownInlineParser.fsCurrentRange field simplified from option to plain MarkdownRange; all option-matching removed from range computations
  • MarkdownBlockParser.fsupdateCurrentRange returns MarkdownRange directly (with MarkdownRange.zero for empty input)
  • Markdown.fs – Removed Some() wrapper from initial CurrentRange
  • Transformations.fs, ParseScript.fs, Formatting.fs, Literate.fs – All range None args replaced with MarkdownRange.zero
  • tests/ – Updated test expectations: Some({StartLine = ...; ...}){StartLine = ...; ...}
  • RELEASE_NOTES.md – Added changelog entry

Breaking Change

This is a breaking API change for any code that:

  • Pattern-matches on MarkdownSpan or MarkdownParagraph with named range fields
  • Constructs MarkdownSpan or MarkdownParagraph values with explicit range arguments
  • Uses range.Value or matches Some r/None on the range field

Migration: replace range: MarkdownRange optionrange: MarkdownRange, and any None range → MarkdownRange.zero.

Test Status

Build: ✅ Passed
Tests: ✅ All 257 tests passed

Generated by Repo Assist for issue #742

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@da02dddebe71d9a937665abdcd1f5214dab852a7

Replace all `range: MarkdownRange option` fields in the MarkdownSpan
and MarkdownParagraph discriminated unions with `range: MarkdownRange`,
using `MarkdownRange.zero` as the fallback where no range was available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review March 4, 2026 09:12
@dsyme dsyme closed this Mar 6, 2026
@dsyme dsyme reopened this Mar 6, 2026
@dsyme
Copy link
Contributor

dsyme commented Mar 7, 2026

/repo-assist fix CI please - ubuntu is failing

… breaking change

The PR changed MarkdownRange from option to non-optional in all DU cases.
docs/evaluation.fsx was missed and still used None for range arguments in
Literal, Paragraph, and ListBlock constructors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

github-actions bot commented Mar 7, 2026

Commit pushed: a14e9d2

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

github-actions bot commented Mar 7, 2026

🤖 This is an automated response from Repo Assist.

Fixed! The CI failure in docs/evaluation.fsx was caused by the same breaking change this PR introduces — MarkdownRange is now non-optional, but the docs file still passed None for range arguments in Literal, Paragraph, and ListBlock constructors.

I've pushed a fix replacing the three None range args with MarkdownRange.zero. CI should pass now.

Generated by Repo Assist for issue #1067 ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@8e6d7c86bba37371d2d0eee1a23563db3e561eb5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional range information for Markdown elements

1 participant