Skip to content

Support styled code lines and custom viewer colors - #8

Open
jeregrine wants to merge 1 commit into
elixir-crab:mainfrom
jeregrine:feat/code-line-styling
Open

jeregrine wants to merge 1 commit into
elixir-crab:mainfrom
jeregrine:feat/code-line-styling

Conversation

@jeregrine

Copy link
Copy Markdown

Summary

Accept optional GPUI.Text.StyleRun values on code lines and render their colors, weights, and font styles natively. Callers supply ranges in the original line's UTF-16 coordinates; native rendering translates them to UTF-8 byte ranges after expanding tabs. This uses the existing typed text contract without adding a highlighter dependency.

Validate that runs are bounded, sorted, non-overlapping, and on UTF-16 character boundaries. Ordinary code rows now honor the viewer's custom background and foreground; selection retains its high-contrast foreground and existing diff/log row colors remain intact. Omitted styles preserve plain-text lines.

Evidence

Serialization and validation tests cover emoji surrogate boundaries, invalid and overlapping ranges, multiline text, and the 512-run limit. A native Rust regression checks that highlighting def in 😀\tdef lands at the correct byte range after tab expansion. Syntax highlighting and custom code surfaces were also inspected in a native light/dark prototype.

Clean package validation remains blocked in the unchanged transitive gpui-component dependency by incompatible upstream APIs, before compiling this bridge.

Release Notes:

  • [GPUI] Added typed code-line styling and custom code-viewer surface colors for application-owned syntax highlighting.

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.

1 participant