Skip to content

Repository files navigation

English | 简体中文

SweetEditor

Cross-Platform Code Editor Core (C++17)

A C++17 core with platform-native rendering, built for long-term editor infrastructure in IDEs, AI programming tools, cloud development workspaces, and similar products.

C++17 Targets License

Android / iOS / macOS / Windows / Swing / OHOS / Flutter / Avalonia / Web


Project Positioning

SweetEditor is a cross-platform code editor core for products that need consistent editing behavior across supported platforms.

It adopts a "C++17 core + platform-native rendering" architecture: the C++ core is responsible for document editing semantics, text layout, and the decoration model, while each integration layer handles input forwarding and rendering.

It is suited for long-term editor infrastructure in IDEs, AI programming tools, cloud development workspaces, and similar products.

Core Features

  • One unified core, reused across platforms: capabilities such as highlighting, folding, Inlay Hints, Ghost Text, and structural guides are all generated by a single C++ core
  • Separation of core and rendering: integration layers focus on input bridging and native drawing, reducing regression risk and maintenance cost across targets
  • Comprehensive advanced editing capabilities: supports code folding, snippets, linked editing, diagnostic decorations, completion extensions, and more
  • A clear performance path: built on Piece Table, incremental layout, viewport rendering, SIMD Unicode acceleration, and mmap-based large-file loading
  • Friendly integration: supports Android, Apple platforms, Windows, Swing, OHOS, Flutter, Avalonia, and Web

Implementation Status

Target Status Rendering Technology UI Framework Implementation
Android Implemented Canvas + Paint Android View Android README
iOS Implemented CoreText + CoreGraphics UIKit / SwiftUI (being refined) Apple README
macOS Implemented CoreText + CoreGraphics AppKit / SwiftUI (being refined) Apple README
Windows Implemented GDI+ WinForms WinForms README
Swing Implemented Java2D Swing Swing README
OHOS Implemented ArkUI Canvas ArkUI OHOS README
Flutter Implemented TextPainter Flutter Flutter README
Avalonia Implemented DrawingContext Avalonia Avalonia README
Qt Implemented QPainter Qt FinalScave/SweetEditor-Qt
Compose Multiplatform In Progress Compose Canvas Compose lumkit/SweetEditor-Compose
Web Core bindings implemented WebAssembly - Web README
C# WinUI Planned - - -

Overall Architecture

+-----------------------------------------------------------------------------------+
| Android | Apple | Swing | WinForms | OHOS | Flutter | Avalonia | Web             |
| Input / rendering / native resources / lifecycle                                 |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| SweetEditor Core (C++17)                                                          |
| Document / editing / layout / decorations / interaction / undo and redo           |
+-----------------------------------------------------------------------------------+

For the full architecture documentation, see Architecture

Core Capabilities

The C++ core covers document editing (Piece Table, undo/redo, large-file loading), text layout (word wrapping, incremental layout, viewport clipping), styling and decorations (syntax/semantic highlighting, Inlay Hints, Ghost Text, diagnostics, structural guides), advanced editing (code folding, snippets, linked editing), and platform extension mechanisms (DecorationProvider, CompletionProvider). Performance is built on SIMD Unicode transcoding, measurement caching, and viewport-level rendering.

For the complete capability list, see EditorCore API.

Quick Start

Build

git clone https://github.com/FinalScave/SweetEditor.git
cd SweetEditor
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j

For quick-start guides, start with the implementation README files below. For bridge and control API details, see the Integration API Index.

Minimal Integration Example

SweetEditor editor = new SweetEditor(context);
editor.applyTheme(EditorTheme.dark());
editor.loadDocument(new Document("Hello, SweetEditor!"));

For more examples, see the integration API documentation.

Demo Screenshots

Android
Android screenshot
macOS
macOS screenshot
Windows (WinForms)
WinForms screenshot
Swing
Swing screenshot

The original Android screenshot has a relatively low resolution, so it is displayed here at a smaller width.

Dependencies

SweetEditor follows a minimal-dependency principle. The core runtime depends only on a small set of lightweight libraries:

  • simdutf: SIMD-accelerated Unicode encoding and decoding
  • nlohmann/json: JSON debug export and internal helper structures
  • utfcpp: UTF-8 iteration and validation

Testing uses Catch2.

Documentation

Document Description
Architecture Core architecture, module design, data flow, and rendering pipeline
EditorCore API Reference for the C++ core layer and C API
Integration API Index Entry point for all integration API documents
Integration Implementation Standard Required types, module structure, API contracts, and compliance rules for all integrations
Contributing Repository structure, reading entry points, and platform synchronization checkpoints

Integration Guides

Target Guide
Android Android README
Apple Apple README
Avalonia Avalonia README
Flutter Flutter README
OHOS OHOS README
Swing Swing README
WinForms WinForms README
Web Web README

Contributing

SweetEditor is building an open ecosystem for cross-platform editor infrastructure, and contributions are welcome.

See Contributing Guide for details.

Community

Discord

Join Discord
QQ

QQ group QR code

QQ Group ID: 1090609035

WeChat

WeChat group QR code

License

SweetEditor is licensed under the MIT License.

About

One core. Every platform. SweetEditor is an industrial-grade C++17 code editor engine delivering native, IDE-class editing on Android, iOS, macOS, Windows, Web, and Swing with blazing performance and unified behavior.

Resources

Stars

202 stars

Watchers

29 watching

Forks

Releases

Packages

Contributors

Languages