Skip to content

Keyboard-registry follow-ups: CollisionPrecedence naming, livepreview.ts coverage #120

Description

@samkeen

Two small items with the same provenance (#118) and nothing else in common. Neither blocks anything.

1. Two unrelated things are called "collision." ui/src/types.ts:313 defines CollisionPrecedence ("incumbent" | "tie_break") and a precedence field — that's the cross-note b2id collision reporting from #81, incumbent-wins, nothing to do with keyboards. Since #118 the frontend also has conflicts() returning Conflict for two commands answering to one keystroke. Both are correct in isolation; together they ask the reader to disambiguate "collision" from surrounding context. Rename one side — conflict reads naturally on the keyboard side, or give the b2id one a word of its own.

2. livepreview.ts is testable now and barely tested. #118 made it node-importable as a side effect of needing one predicate under test: two widget classes used constructor parameter properties (the one TypeScript construct --experimental-strip-types refuses, which made the whole module unimportable), and ./render needed to become ./render.ts since node resolves specifiers literally. livepreview.test.ts currently exercises only isFollowClick.

There's real pure logic now in reach and untested:

  • taskChecked — the [ ]/[x] marker read
  • the wikilink grammar: WIKILINK_RE and the parseInline rules ([[target|label]], the ]/newline scan, the rejections for empty content and a leading |)
  • the decoration builders, to the extent they're separable from a live EditorView

Worth noting the second one is an opportunity rather than a debt — the module was never in the suite, so nothing regressed.

Left over from the keyboard-registry work in #118.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions