Feature: Public API for sub-line span decorations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start by reading the existing intra-line diff highlighting built with Shiki DecorationItems and the exported createDiffSpanDecoration, then compare the consumer APIs on File, FileDiff, CodeView, and BaseCodeOptions. The issue leaves the API shape and naming open, so settle those questions before implementation. Done means consumers can supply character ranges and have them rendered as spans with the requested class.
Written by the indexing model from the issue text.
Description
Prerequisites
- I have searched for duplicate or closed feature requests
- I have read the contributing guidelines
Proposal
Hi! Big fan.
I (on behalf of design systems @ Anthropic) would like to propose a consumer-facing way to style arbitrary character ranges within a rendered line. Something like a spanDecorations input on File / FileDiff / CodeView that addresses {lineNumber, spanStart, spanLength, className} and wraps the range in a span carrying the class.
The machinery seems to already exists internally... intra-line word/char diff highlighting is implemented with Shiki DecorationItems, and createDiffSpanDecoration is already exported. This would be exposing that stuff for consumer-supplied ranges. I'm aware of #459; this is the character-granularity counterpart, and I'd want to pick a name that doesn't collide with it.
Open API questions I'd defer to y'all on:
- Render prop (like
lineAnnotations) vs. option onBaseCodeOptions - Whether interaction callbacks (
onDecoration*, mirroringonToken*) are in scope or a separate ask - Naming (
spanDecorationsvs. something else, given #459)
I'd previously opened #810 with an implementation before discussing it here (sorry for jumping the gun!) That PR is available as a reference if useful, but I'm treating the API shape as fully open.
Motivation and context
We use @pierre/diffs in an internal code review tool. We'd like to add overlays anchored to sub-line ranges for things like...
- Highlighting high-risk spans (e.g. flagging string-concatenated SQL on an added line)
- Muting low-relevance code so the behavioral change stands out
- IDE-style diagnostics squiggles at exact character positions
- Anchoring AI-assist affordances (click a flagged span → explainer card)
I had Claude create some examples of this in action:
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 226
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 34
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pierrecomputer/pierre
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pierrecomputer/pierre#1187 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pierrecomputer/pierre#1150 · 3 comments ·
Maintainers usually reply within 1 day
-
Bug: Dragging a selection past the edge of an editable CodeView collapses it, then stops it growingOpenbug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pierrecomputer/pierre#1189 ·
Maintainers usually reply within 1 day
-
Bug: WebKit crashes when drag-selecting text that auto-scrolls a diff (gutter-utility re-parented mid-drag)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
pierrecomputer/pierre#1184 · 4 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 63/100
pierrecomputer/pierre#1172 ·
Maintainers usually reply within 1 day
All issues in pierrecomputer/pierre
Similar issues
-
Create/import wallet form shows raw "password must be at least 1 characters" instead of the translated messagePossibly taken @CapThunder19 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
joinmarket-webui/jam#1538 ·
Maintainers usually reply within 1 day
-
t0ggles
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nolimits4web/swiper#8240 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelcontextprotocol/inspector#2723 ·
Maintainers usually reply within 1 day
-
status:approved type:bug
Difficulty 1/5 Under an hour Newbie friendliness 70/100
egdev6/quorb#109 · 1 comment ·
Maintainers usually reply within 1 day