Skip to content

feat(#439): syntax highlighting for markdown code blocks#688

Open
lokhor wants to merge 12 commits intomainfrom
feat/439-code-syntax-highlighting
Open

feat(#439): syntax highlighting for markdown code blocks#688
lokhor wants to merge 12 commits intomainfrom
feat/439-code-syntax-highlighting

Conversation

@lokhor
Copy link
Copy Markdown
Collaborator

@lokhor lokhor commented Apr 25, 2026

Summary

  • Add CodeTokenizer with 8 language tokenizers (Kotlin, Java, JS/TS, Python, Swift, Go, Rust, JSON)
  • Integrate tokenized highlighting into MarkdownRenderer.FencedCodeBlock using Material 3 semantic colors
  • Add Compose previews for all supported languages
  • Unit tests for all tokenizers with 40+ assertions

Why

Syntax highlighting for code blocks is a core UX feature (issue #439) that improves readability of code snippets in chat responses.

How to test

  • Open the app and send a message containing code blocks in different languages
  • Verify syntax highlighting colors match Material 3 semantic palette (keywords in primary, types in tertiary, strings in secondary)
  • Run CodeTokenizerTest unit tests

Screenshots

Compose previews included for Kotlin, Python, JavaScript, Rust, Go, Swift, TypeScript, and Java code blocks.

Related issues

Closes #439

lokhor and others added 12 commits April 22, 2026 22:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merge in new multi-stage meal planning skill that:
- Fixes partial-save issue by enforcing dual bulk_add_to_list calls
- Adds 4-stage flow: preference collection → high-level plan → detailed recipes → iteration
- Implements state persistence across context window changes
- Enforces grouped questions (2-3 per batch) instead of sequential

Replaces the basic meal planner from commit 5419b84 with the enhanced version.
…ill sequencing in the tool-use prompt\n- explicitly forbid run_intent during skill selection and loading\n- reject skill names passed to run_intent with a helpful error\n- fix meal planner examples to use bulk_add_to_list\n- clarify meal planner only uses run_intent during save stage\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…amples with exact runIntent syntax\n- forbid creating a master meal plan list\n- require full per-day ingredient payloads for shopping list saves\n- enforce metric/NZ-friendly units instead of imperial output\n- remove meal-plan anchoring from generic create_list example\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n a meal' and similar phrasing as tool queries\n- treat short confirmations like 'continue' and 'ok let\'s do it' as tool follow-ups when prior exchange is tool-driven\n- preserve previous exchange context for tool follow-up turns\n- add focused tests for meal planner follow-up routing\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add CodeTokenizer with 8 language tokenizers (Kotlin, Java, JS/TS,
  Python, Swift, Go, Rust, JSON)
- Integrate tokenized highlighting into MarkdownRenderer FencedCodeBlock
  using Material 3 semantic colors
- Add Compose previews for all supported languages
- Unit tests for all tokenizers with 40+ assertions
- Fix redundant isUpperCase() && isUpperCase() condition in JSTokenizer
- Remove duplicate entries from KOTLIN_KEYWORDS (is, apply)
- Remove duplicate entries from JS_KEYWORDS (delete, typeof, true, false)
- Remove duplicate entries from GO_KEYWORDS (go, select)
- Remove built-in functions from JS_KEYWORDS (string, number, boolean)
- Add produceState for async tokenization to avoid UI jank
- Fix JS tokenizer: add 'await' to keyword set
- Fix Go tokenizer: check GO_TYPES before Variable fallback
- Fix Java tokenizer: simplify keyword/type checking logic
- Fix Python tokenizer: check PYTHON_TYPES, remove built-in functions from keywords
- Fix Kotlin tokenizer: use find() instead of matchEntire() for annotations, check KOTLIN_TYPES, fix function name fallback to Other
- Remove unused imports and dead code
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.

code formatting idea

1 participant