Skip to content

Commit 306b74e

Browse files
fazxesclaude
andcommitted
feat(snowflake-core): implement core text editing primitives
Add comprehensive text editing foundation with: - Position: line/column with LSP conversion and ordering - Range: start/end positions with contains, intersects, is_empty - Buffer: ropey wrapper for efficient insert/delete/replace - Selection: anchor/head model with direction tracking - Edit/EditHistory: undo/redo with 1000 entry stack - Document: file I/O, language detection, full editing API Includes 67 tests covering edge cases: - Multiple undo/redo cycles - Multiline operations - Unicode handling - Out-of-bounds clamping - Empty operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c80cfee commit 306b74e

10 files changed

Lines changed: 2085 additions & 1 deletion

File tree

‎Cargo.lock‎

Lines changed: 41 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/snowflake-core/Cargo.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ workspace = true
1414
serde = { workspace = true }
1515
serde_json = { workspace = true }
1616
thiserror = { workspace = true }
17+
ropey = "1.6"
18+
lsp-types = { workspace = true }

‎crates/snowflake-core/src/lib.rs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
//! Snowflake Core - Shared types and utilities
22
//!
33
//! This crate provides the foundation types used across all Snowflake crates.
4+
//!
5+
//! # Text Editing
6+
//!
7+
//! The [`text`] module provides core text editing primitives:
8+
//!
9+
//! - [`text::Position`] - A position in a document (line, column)
10+
//! - [`text::Range`] - A range between two positions
11+
//! - [`text::Buffer`] - An efficient text buffer backed by a rope
12+
//! - [`text::Selection`] - A selection with anchor and head
13+
//! - [`text::Edit`] - An edit operation
14+
//! - [`text::EditHistory`] - Undo/redo history
15+
//! - [`text::Document`] - A text document with editing capabilities
416
517
pub mod error;
18+
pub mod text;
619
pub mod types;
720

821
pub use error::{Error, Result};
22+
pub use text::{Buffer, Document, DocumentMeta, Edit, EditHistory, Selection, SelectionDirection};
923
pub use types::*;

0 commit comments

Comments
 (0)