Skip to content

Yasuno-5555/rusteditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Visual MIR Editor 🦀✨

"Code is a design, but MIR is the truth."
A next-generation IDE prototype for visualizing, editing, and executing Rust source code as interactive Visual Semantic Graphs (VSG). Rustのソースコードを、インタラクティブなビジュアル・セマンティック・グラフ (VSG) として視覚化し、編集し、実行するための次世代IDEプロトタイプ。


🌌 Dual-Reality Architecture

The editor is designed with a clear separation between two layers that you can seamlessly transition between. UIとシステムを「2つの層」に明確に分割し、それらをシームレスに行き来できる設計を採用しています。

1. Surface Layer: 【Editor Mode】

A permissive environment where users can intuitively build logic relying on "Spatial Memory". ユーザーが「空間記憶」を頼りに、直感的にロジックを組むための寛容な環境。

  • Spatial Memory Protection: Node coordinates are preserved in .sidecar files. They never move unless you manually "Tidy Up".
    • 空間記憶の保護: ノードの座標は .sidecar ファイルに保存され、手動の整理 (Tidy Up) をしない限り勝手に動きません。
  • Stable Undo/Redo: Managed via "Logical Operations" rather than text diffs. Logical-to-Physical ID Remapping ensures perfect consistency between nodes and wires even after history operations.
    • Stable Undo/Redo: テキスト差分ではなく「論理操作」ベースで管理。Logical-to-Physical ID Remapping により、履歴操作後もノードとワイヤーの整合性が完璧に保たれます。

2. Deep Layer: 【X-Ray Mode】

Overlay the "Cold Truth" as seen by the compiler. コンパイラが見ている「冷徹な真実」をオーバーレイ表示。

  • MIR Peek: Structured parsing of rustc Mid-level Intermediate Representation (MIR) to build 1:1 mapping with VSG.
    • MIR Peek: rustc の中間表現を構造化パースし、VSGとの 1:1 対応を構築。
  • Lifetime Visualization: Visualize lifetimes as "Energy Fields" on the canvas using Metaball rendering.
    • Lifetime Visualization: 生存期間をキャンバス上の「エネルギーフィールド(Metaball rendering)」として表現。

🚀 Quick Start

# Clone and run (Mac/Linux)
git clone <repo-url>
cd rusteditor
./run.sh

# Windows
run.bat

🛠 Core Technical Features

🦖 Surgical Patching

No total code regeneration. We use ra_ap_syntax (CST) to replace only the specific TextRanges that need changes. Your comments, whitespace, and formatting are perfectly preserved. ソースコードの再生成は一切行いません。ra_ap_syntax (CST) を使用して、変更が必要な 特定のTextRangeのみを置換 します。ユーザーの書いたコメント、空白、フォーマットが完璧に守られます。

🔬 Intelligent Diagnostics & Borrow Story

Analyzes cargo check errors to provide an experience beyond simple error messages. cargo check のエラーを解析し、単一のエラー表示を超えた体験を提供します。

  • Reason Bubbles: Floating bubbles on nodes explaining compiler reasoning.
    • Reason Bubbles: コンパイラの推論理由をノード上に吹き出し表示。
  • Borrow Story Mode: Explains complex borrow errors as a step-by-step story ("where it was lent, where it collided").
    • Borrow Story モード: 複雑な借用エラーに対し、「どこで貸し出され、どこで衝突したか」を紙芝居形式(Story Steps)で解説します。
  • Auto-Suggestions: One-click solutions like inserting .clone() or limiting scopes based on error codes.
    • Auto-Suggestions: エラーコードに基づき、.clone() の挿入やスコープ制限などの解決策をワンクリックで提案。

🛡️ Safe Code Syncing

Wiring changes are not reflected immediately in the source code but are held as "Pending Changes". A safety design that doesn't break source code until you approve it. 配線変更によるコード編集は即座に反映されず、「Pending Changes」 としてプレビューされます。ユーザーが承認するまでソースコードを破壊しない安全設計です。


⌨️ Operation Guide (Key Bindings)

Key Action
Alt (Hold) Enable X-Ray Mode (Show Ownership/MIR)
Cmd + S Save & Run Compile Check
Cmd + K Command Palette (Tidy Up / Fetch MIR, etc.)
Cmd + Z / Shift+Z Undo / Redo (Maintain ID Consistency)
Space Toggle X-Ray Mode

🚀 Technology Stack

  • UI: egui 0.31 & egui_dock 0.16
  • Graph: slotmap (Generational indices) + ID Remapping Engine
  • Parsing: ra_ap_syntax (CST) / nom 8.0 (MIR structured parsing)
  • Async: Tokio-based background worker system

🤝 Message to Developers

This project is not about "hiding the complexity of Rust". Rather, it's a tool for "loving the spatial rigor of Rust". このプロジェクトは「Rustの難解さを隠す」ためのものではありません。むしろ、**「Rustの厳密さを空間的に愛でる」**ための道具です。

Warning: This project is a prototype in development. It uses -Zunpretty=mir, so the nightly toolchain is recommended.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages