English | 简体中文
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.
Android / iOS / macOS / Windows / Swing / OHOS / Web*
This repository is an unofficial fork maintained by LangLang03, and is not the official OpenSweetEditor repository.
Official upstream repository: FinalScave/OpenSweetEditor
SweetEditor is a cross-platform code editor core designed for products that need consistent editing behavior across Android, iOS, macOS, Windows, Swing, and OHOS.
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 platform 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.
- 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: platform layers focus on input bridging and native drawing, reducing regression risk and maintenance cost across platforms
- 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 native integration: already adapted for Android, Apple platforms, Windows, Swing, and OHOS, with Web support currently in testing through an unofficial fork
| Platform | Status | Rendering Technology | UI Framework | Implementation |
|---|---|---|---|---|
| Android | Implemented | Canvas + Paint | Android View | ./platform/Android |
| iOS | Implemented | CoreText + CoreGraphics | UIKit / SwiftUI (being refined) | ./platform/Apple |
| macOS | Implemented | CoreText + CoreGraphics | AppKit / SwiftUI (being refined) | ./platform/Apple |
| Windows | Implemented | GDI+ | WinForms | ./platform/WinForms |
| Swing | Implemented | Java2D | Swing | ./platform/Swing |
| OHOS | Implemented | ArkUI Canvas | ArkUI | ./platform/OHOS |
| Flutter | Implemented | TextPainter | Flutter | ./platform/Flutter |
| Qt | Implemented | QPainter | Qt | FinalScave/SweetEditor-Qt |
| Compose Multiplatform | In Progress | Compose Canvas | Compose | lumkit/SweetEditor-Compose |
| Web | Testing (Unofficial) | - | - | LangLang03/OpenSweetEditor-Web |
| C# Avalonia UI | Planned | - | - | - |
| C# WinUI | Planned | - | - | - |
+-----------------------------------------------------------------------------------+
| Platform Layer (Input + Render) |
| |
| Android Apple Swing / WinForms OHOS Web* |
| Canvas CoreText/CG Java2D / GDI+ ArkUI Canvas Testing |
+----------------+-------------+----------------------+---------------+--------------+
| | | |
| JNI direct | manual C bridge | C API / payload | NAPI direct
v v v v
+----------------+ +----------------+ +------------------+ +-------------------+
| JNI Bridge | | Apple Bridge | | C API Bridge | | OHOS NAPI Bridge |
| jni_entry | | Swift + C | | extern "C" | | ArkTS + NAPI |
+----------------+ +----------------+ +------------------+ +-------------------+
\ | | /
\ | | /
+-------------+-----------------+------------------+
|
v
+--------------------------------------------------+
| SweetEditor Core (C++17) |
| Document / TextLayout / DecorationManager / |
| EditorCore / GestureHandler / UndoManager / |
| LinkedEditing |
+--------------------------------------------------+
For the full architecture documentation, see Architecture
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.
git clone https://github.com/LangLang03/OpenSweetEditor-Web.git
cd OpenSweetEditor
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -jFor platform quick-start guides and WebAssembly testing builds, see the Platform API Index.
SweetEditor editor = new SweetEditor(context);
editor.applyTheme(EditorTheme.dark());
editor.loadDocument(new Document("Hello, SweetEditor!"));For more examples, see the platform API documentation.
The original Android screenshot has a relatively low resolution, so it is displayed here at a smaller width.
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.
| Document | Description |
|---|---|
| Architecture | Core architecture, module design, data flow, and rendering pipeline |
| EditorCore API | Reference for the C++ core layer and C API |
| Platform API Index | Entry point for Android, Swing, Apple, WinForms, and OHOS platform API docs |
| Platform Implementation Standard | Required types, module structure, API contracts, and compliance rules for all platform implementations |
| Web Platform API (Guide) | Web SDK v2 usage guide, build flow, runtime bundling, and CDN integration |
| Web SDK v2 Full API Reference | 100% declaration coverage for @sweeteditor/sdk, @sweeteditor/core, @sweeteditor/widget, and @sweeteditor/providers-sweetline |
| Contributing | Repository structure, reading entry points, and platform synchronization checkpoints |
SweetEditor is building an open ecosystem for cross-platform editor infrastructure, and contributions are welcome.
See Contributing Guide for details.
|
Discord Join Discord |
QQ
QQ Group ID: 1090609035 |
WeChat
|
SweetEditor is licensed under the GNU Lesser General Public License v2.1 or later (LGPL-2.1+), with an additional Static Linking Exception provided as a supplementary clarification.





