oxidecomputer / oxidecomputer/prettier-plugin-asciidoc

The block boundary gate parses the list marker twice per line

Open
#277 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

foundation mechanism:block-reading obligation:completeness
Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

What this is

blockBoundaryReach (src/parse/lines/classify.ts:887) and blockBoundaryOnlyKind (classify.ts:1065) both call parseListMarker on the same line: the first to decide whether the reader lets the marker line win, the second to build the marker arm. The JSDoc at classify.ts:1008-1009 already says the call is made once for both, which is not what the code does. This was the status quo on main before the #232/#261 resolution grouped the arms (reachesLayoutBreak and classifyBlockBody each parsed it too), so it is not a regression, but the coding standard says a fact the caller already holds is not re-derived.

The change

BlockBoundaryReach carries the parsed marker as a payload on the arms that have one (ParsedMarker | undefined, or an arm per case), so the second parse is deleted and the JSDoc becomes true. About 5 code lines and one regex ladder per block-start line. No behaviour change.

Gate

The #182/#242 pins (tests/format/spaced-thematic-break.test.ts), the #232 and #261 pins (tests/parser/include.test.ts, tests/format/include.test.ts) unchanged; bun run test, check, lint green; classify.ts stays under its max-lines ceiling (it is at 1188 lines total; measure). Found by the boundaryresolve re-check and the Sep 7 subtraction map.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/parse/lines/classify.ts around blockBoundaryReach at line 887, the JSDoc at lines 1008-1009, and blockBoundaryOnlyKind at line 1065. Trace the BlockBoundaryReach arms and their callers, then run the listed pins and bun run test, check, and lint. Done means the marker is parsed once per line, the JSDoc is accurate, behavior is unchanged, and classify.ts remains under its max-lines ceiling.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, typescript
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.