Skip to content

Add start/end comments for multi-line annotation ranges#532

Merged
pomber merged 7 commits intonextfrom
feat/start-end-annotations
Mar 17, 2026
Merged

Add start/end comments for multi-line annotation ranges#532
pomber merged 7 commits intonextfrom
feat/start-end-annotations

Conversation

@pomber
Copy link
Contributor

@pomber pomber commented Mar 16, 2026

Fix #530

Summary

  • add !name(start) / !name(end) comment markers for multi-line annotation ranges
  • keep nested ranges of the same annotation name paired correctly
  • ignore adjacent empty ranges and cover the behavior with regression tests

Usage

Before, multi-line ranges had to use the existing explicit range syntax:

// !focus(2:3)
const a = 1
const b = 2
const c = 3

This PR adds comment markers as an alternative:

const a = 1
// !focus(start)
const b = 2
const c = 3
// !focus(end)
const d = 4

That produces the same multi-line focus annotation over const b = 2 and const c = 3.

Testing

  • pnpm --dir packages/codehike build
  • pnpm --dir packages/codehike exec vitest run src/code/extract-annotations.test.ts

pomber and others added 2 commits March 16, 2026 16:24
Add `!name(start)` and `!name(end)` syntax for defining multi-line
annotation ranges. This allows annotations like `!focus` to span
multiple lines without specifying explicit line numbers.

Closes #530

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codehike.org Ready Ready Preview, Comment Mar 17, 2026 8:28am

Request Review

@pomber pomber changed the title Support multi-line annotation ranges Add start/end comments for multi-line annotation ranges Mar 16, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 16, 2026

Try codehike from this pull request in your project with:

npm i https://pkg.pr.new/codehike@532

@pomber pomber merged commit b641376 into next Mar 17, 2026
4 checks passed
@github-actions github-actions bot removed the changeset PR including changesets label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multi-line annotation ranges with start and end comments

1 participant