firstOwnLine walks node kinds to re-derive whether the head drain reached the end of the item's text

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

Nobody has claimed this yet.

Assessment

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

Research direction

Start with ItemBody.headDrain in src/head-drain-record.ts and its consumer in src/parse/lines/list-item-node.ts, then inspect firstOwnLine in src/print/list-hazard.ts around line 283. Replace the node-kind walk with the recorded headDrain fact and remove the walk. Validate the change with a perturbation on the list-shape grid showing both answers were equal before the change.

Written by the indexing model from the issue text.

Description

mechanism:licensed-emission obligation:model-fidelity

Split from #325, row R6 (verified at main ffdc1860).

The question: did a drain reach the end of the item's text?

The reader's answer: ItemBody.headDrain (src/head-drain-record.ts), written by the list scan.

The second answerer: firstOwnLine in src/print/list-hazard.ts l.283, a walk over node kinds returning comment | hardBreak | undefined; the comment above it states the equivalence with the recorded fact in words.

Constraint from #325: HeadDrainFact has a second live consumer at src/parse/lines/list-item-node.ts (the drain.kind === "detached" clause, byte-witnessed by mutation: disabling it makes * <95 cols>\n// c\n+\n\nnext\n wrap, and wrap again on the second pass). Deleting the record is foreclosed; the printer reads it instead.

Closes when: firstOwnLine reads headDrain and the walk is deleted, with a perturbation showing the two answers were equal on the list-shape grid before the change.

Related: #325 (the catalog), #90 (the class), #274 (the separator half of the head drain record).

Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

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.

More from oxidecomputer/prettier-plugin-asciidoc

All issues in oxidecomputer/prettier-plugin-asciidoc

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.