Skip to content

Repository files navigation

Baikal

A fast, Unicode-correct editor engine written in Rust.

Baikal is the foundation for code editors and IDEs that need a serious text model without embedding a browser editor. It keeps document state, selections, undo/redo, tracked ranges, layout and language integrations separate from the frontend that renders them.

Status: 0.1.0-alpha. The core is usable for experiments and early integrations. APIs are intentionally allowed to change before 1.0.

Why Baikal

  • Rope-backed text storage for large documents.
  • Correct UTF-8, UTF-16, grapheme and display-column positions.
  • Atomic multi-cursor editing with undo/redo.
  • Anchors, diagnostics, decorations and folding that follow edits.
  • Wrapping, hit testing and renderer-facing viewport frames.
  • Snippets with tabstops, mirrored placeholders and tracked navigation.
  • Incremental syntax and LSP building blocks.
  • No UI framework in the core: use a TUI, web frontend, native shell or bridge.

Baikal is not a Monaco drop-in replacement yet. It does not currently ship a production frontend, stable plugin API or a complete language-feature set.

Quick start

Rust stable, clippy, and rustfmt are selected automatically through rust-toolchain.toml.

git clone https://github.com/MilakyS/BaikalEngine.git
cd BaikalEngine
make check
make test

Run the experimental terminal editor against a file:

make tui FILE=crates/baikal-core/src/lib.rs

Run the JSON-RPC bridge over HTTP:

make bridge ARGS=--http

Small API example

use baikal_core::{Document, Editor, SnippetTemplate};

let mut editor = Editor::new(Document::from_text(""));
let snippet = SnippetTemplate::parse("fn ${1:name}(${2:args}) { $0 }")?;

editor.insert_snippet(&snippet)?;
editor.insert_text("build")?;
editor.next_snippet_tabstop();
editor.insert_text("value: u32")?;
# Ok::<(), baikal_core::EditorError>(())

Architecture

baikal-core       document model, editor commands, selections, tracking, snippets
baikal-index      versioned derived indexes for immutable snapshots
baikal-layout     wrapping, hit testing and viewport geometry
baikal-syntax     incremental Tree-sitter integration
baikal-lsp        LSP client, transport and document synchronisation
baikal-protocol   JSON-RPC wire contract
baikal-bridge     headless JSON-RPC sidecar
baikal-tui        experimental terminal frontend

The dependency direction is deliberate: frontends and transports depend on the engine; the engine never depends on a UI.

Development

make help
make check                         # fmt + clippy
make test-crate CRATE=baikal-core  # focused test loop
make bench CRATE=baikal-core
make gate                          # full local/CI gate

make gate-offline runs the same checks without network access when Cargo's cache is already populated.

The non-negotiable standards are documented in CODE_STYLE.md: KISS, explicit invalidation, UTF correctness, measured performance work and Clippy zero.

Roadmap

Near-term engine work:

  • completion contract and snippet-aware completion application;
  • signature help, hover and code actions over the language layer;
  • more fold-aware and language-aware renderer data;
  • benchmarks and profiling for large-file interactive workloads.

The roadmap is intentionally engine-first. A frontend should consume stable engine contracts rather than become the place where text correctness lives.

Contributing

Focused pull requests are welcome. Please read CONTRIBUTING.md and run make gate before opening one. Use the bug and feature templates under .github/ISSUE_TEMPLATE for reproducible reports and concrete editor workflows.

Security

Report vulnerabilities through a private GitHub security advisory, not a public issue. See SECURITY.md.

License

Licensed under either of

at your option.

About

No description or website provided.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages