Skip to content

highlighter: Preserve text color without syntax highlighting#2570

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
refmdio:fix/wasm-highlighter-fallback
Jul 15, 2026
Merged

highlighter: Preserve text color without syntax highlighting#2570
huacnlee merged 1 commit into
longbridge:mainfrom
refmdio:fix/wasm-highlighter-fallback

Conversation

@MuNeNiCK

Copy link
Copy Markdown
Contributor

Related to #2325

Description

When the tree-sitter feature is disabled, the stub implementation of SyntaxHighlighter::styles returns an empty style list.

The input renderer builds text runs from that list. When the list is empty, no colored text run is created, so GPUI paints the text with its default black instead of preserving the input's text color.

The native highlighter returns the requested range with HighlightStyle::default() when no styles match. This change aligns the stub implementation with that behavior so the input text color is preserved when syntax highlighting is disabled.

How to Test

  • Run cargo check -p gpui-component --target wasm32-unknown-unknown --lib.
  • Build a web application that uses gpui-component with default-features = false.
  • Enter text in a CodeEditor with a dark theme.
  • Verify that existing and newly entered text use the input's text color.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (if any) is accurate.
  • [N/A] Passed cargo run for story tests related to the changes.
  • [N/A] Tested macOS, Windows and Linux platforms performance (not platform-specific).

@huacnlee
huacnlee merged commit f03f371 into longbridge:main Jul 15, 2026
3 checks passed
@MuNeNiCK

Copy link
Copy Markdown
Contributor Author

Thanks for merging the PR. I really appreciate it.

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.

2 participants