[Repo Assist] Make MarkdownRange non-optional in MarkdownSpan and MarkdownParagraph (fixes #742)#1067
Open
github-actions[bot] wants to merge 3 commits intomainfrom
Conversation
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>
11 tasks
…s-05198c9c9736942f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant, in response to a
/repo-assistcommand on issue #742.Summary
Closes #742
This PR makes the
rangefield non-optional in allMarkdownSpanandMarkdownParagraphdiscriminated union cases, as requested by @dsyme and originally reported by @artempyanykh.Previously, every Markdown AST node had
range: MarkdownRange option. Now all cases haverange: MarkdownRange, withMarkdownRange.zeroused 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
Noneduring parsing was inupdateCurrentRangewhen the line list was empty. This has now been fixed to returnMarkdownRange.zeroinstead.Changes
MarkdownModel.fs– Allrange: MarkdownRange option→range: MarkdownRangeinMarkdownSpanandMarkdownParagraphDU cases;None→MarkdownRange.zeroinDslmoduleMarkdownInlineParser.fs–CurrentRangefield simplified fromoptionto plainMarkdownRange; all option-matching removed from range computationsMarkdownBlockParser.fs–updateCurrentRangereturnsMarkdownRangedirectly (withMarkdownRange.zerofor empty input)Markdown.fs– RemovedSome()wrapper from initialCurrentRangeTransformations.fs,ParseScript.fs,Formatting.fs,Literate.fs– All rangeNoneargs replaced withMarkdownRange.zerotests/– Updated test expectations:Some({StartLine = ...; ...})→{StartLine = ...; ...}RELEASE_NOTES.md– Added changelog entryBreaking Change
This is a breaking API change for any code that:
MarkdownSpanorMarkdownParagraphwith named range fieldsMarkdownSpanorMarkdownParagraphvalues with explicit range argumentsrange.Valueor matchesSome r/Noneon the range fieldMigration: replace
range: MarkdownRange option→range: MarkdownRange, and anyNonerange →MarkdownRange.zero.Test Status
Build: ✅ Passed
Tests: ✅ All 257 tests passed