Skip to content

FinalScave/OpenSweetEditor

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 Platforms License

Android / iOS / macOS / Windows / Swing / OHOS / Web*


Project Positioning

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.

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: 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 Support Status

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
C# Avalonia Implemented - Avalonia ./platform/Avalonia
Qt Implemented QPainter Qt FinalScave/SweetEditor-Qt
Compose Multiplatform In Progress Compose Canvas Compose lumkit/SweetEditor-Compose
Web Testing (Unofficial) - - LangLang03/OpenSweetEditor-Web
C# WinUI Planned - - -

Overall Architecture

+-----------------------------------------------------------------------------------+
|                          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

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/OpenSweetEditor.git
cd OpenSweetEditor
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j

For platform quick-start guides and WebAssembly testing builds, see the Platform 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 platform API documentation.

Platform 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
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
Contributing Repository structure, reading entry points, and platform synchronization checkpoints

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 GNU Lesser General Public License v2.1 or later (LGPL-2.1+), with an additional Static Linking Exception provided as a supplementary clarification.

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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors