Skip to main content

Editor

Read-only code viewer with syntax highlighting, line numbers, and tabbed file management.

Features

  • Syntax highlighting for Swift, Python, JavaScript, TypeScript, Rust, Go
  • Line numbers with monospaced font
  • Tab bar for multiple open files
  • Modified indicator (orange dot) for changed files
  • Line highlighting for drawing attention to specific lines

Syntax Highlighting

The built-in SyntaxHighlighter provides basic token-based highlighting:

let highlighter = SyntaxHighlighter()
let content = highlighter.highlight(source, language: "swift")
// Returns EditorContent with tokenized lines

Token Types

TokenColorExample
KeywordPinkfunc, var, let
StringGreen"hello"
CommentGray// comment
NumberOrange42, 3.14
TypeCyanCustom types
FunctionYellowFunction calls
PropertyPurpleProperty access

Supported Languages

Swift keywords are fully supported. Other languages use generic highlighting rules.