Rode is a text editor written in Rust, built on top of the egui and iced GUI frameworks. This document outlines the architectural design and module organization.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kashsuks/rode/llms.txt
Use this file to discover all available pages before exploring further.
Core Architecture
Rode follows a modular architecture with clear separation of concerns. The application is structured around the App struct, which serves as the central state manager and orchestrates all UI components and functionality.Application Structure
The main application flow is:- Entry Point (
main.rs:24): Initializes the Iced application with the App struct - App Initialization (
app.rs:183): Creates the default application state and checks for updates - Event Loop: Handles user input through the
update()method and renders UI throughview() - Subscription System (
app.rs:990): Listens to keyboard/mouse events for global shortcuts
Module Organization
Rode is organized into the following core modules:UI & Rendering
app
Core application state and logic
- Main App struct with tab management
- Event handling and message routing
- View rendering orchestration
- Located at
src/app.rs
ui
UI components and styling
editor.rs: Text editor widget creationsidebar.rs: File tree sidebar renderingstyles.rs: Custom widget styles- Located at
src/ui/
theme
Theming system
- Color palette definitions
- Built-in themes (Catppuccin, Nord, etc.)
- Syntax highlighting theme integration
- Located at
src/theme.rs
icons
Icon management
- SVG icon loading and rendering
- File type icons for the file tree
- Located at
src/icons.rs
Editor Features
autocomplete
Intelligent code completion
engine.rs: Completion enginecontext.rs: Context analysislanguage.rs: Language-specific providersscoring.rs: Suggestion ranking- Located at
src/autocomplete/
syntax
Syntax highlighting
- Tree-sitter integration for parsing
- Support for Rust, JavaScript, TypeScript, Python
- Syntect for syntax highlighting themes
- Located at
src/syntax.rs
find_replace
Find and replace functionality
- Text search with case sensitivity
- Replace one or replace all operations
- Match navigation
- Located at
src/find_replace.rs
command_input
Vim-style command input
- Colon-command interface
- Command parsing and execution
- Located at
src/command_input.rs
File & Project Management
file_tree
File system navigation
- Lazy-loaded directory scanning
- Folder expansion/collapse
- File selection tracking
- Ignores common directories (
.git,node_modules, etc.) - Located at
src/file_tree.rs
fuzzy_finder
Quick file navigation
- Fuzzy file search across workspace
- File preview on selection
- Keyboard navigation (Ctrl+P)
- Located at
src/fuzzy_finder.rs
search
Workspace-wide search
- Multi-file content search
- Search result aggregation
- File collection and indexing
- Located at
src/search.rs
command_palette
Command palette
- Quick access to editor commands
- Fuzzy command filtering
- Keyboard-driven interface (Ctrl+Shift+P)
- Located at
src/command_palette.rs
Configuration & Preferences
config
Configuration management
preferences.rs: Editor preferences (tab size, spaces, etc.)theme_manager.rs: Custom Lua theme loading- Persistent settings storage
- Located at
src/config/
wakatime
WakaTime integration
client.rs: API client for heartbeatsconfig.rs: WakaTime configuration- Automatic time tracking
- Located at
src/wakatime/
Utilities
terminal
Integrated terminal
- System shell integration
- Directory-aware terminal sessions
- Located at
src/terminal.rs
updater
Auto-update system
- GitHub release checking
- Update notifications
- Located at
src/updater.rs
message
Message types
- Event message definitions
- Message routing enum
- Located at
src/message.rs
resources
Embedded resources
- Asset bundling
- Icon and font embedding
- Located at
src/resources.rs
State Management
TheApp struct in src/app.rs:52 maintains all application state:
View App State Structure
View App State Structure
Message-Driven Architecture
Rode uses Iced’s message-driven architecture. All user interactions generate messages that are processed by theupdate() method:
Tab System
Rode supports multiple file tabs with two types:- Editor tabs: Editable text content with syntax highlighting
- Preview tabs: Read-only markdown preview rendering
File Tree Architecture
The file tree uses a lazy-loading approach for performance:- Initial Scan (
file_tree.rs:71): Only scans the root directory - On Expand: Populates children when a folder is toggled (
file_tree.rs:45) - Ignored Paths: Skips
.git,node_modules,target, etc. (file_tree.rs:68) - State Tracking: Uses a
HashSetto track expanded folders
The file tree only stores expanded folders in the
HashSet to save memory. All other folders are considered collapsed by default.Syntax Highlighting Pipeline
Rode uses a dual approach for syntax highlighting:Keyboard Shortcuts
Global shortcuts are handled inapp.rs:990 via the subscription system:
| Shortcut | Action |
|---|---|
Cmd/Ctrl + B | Toggle sidebar |
Cmd/Ctrl + P | Toggle fuzzy finder |
Cmd/Ctrl + Shift + P | Toggle command palette |
Cmd/Ctrl + F | Find and replace |
Cmd/Ctrl + S | Save file |
Cmd/Ctrl + W | Close tab |
Cmd/Ctrl + N | New file |
Cmd/Ctrl + O | Open folder |
Cmd/Ctrl + J | Toggle terminal |
Escape | Close overlays |
Performance Considerations
Lazy Loading
Lazy Loading
- File tree children are loaded on-demand
- Workspace file indexing happens on folder open
- Preview content is cached in fuzzy finder
Ignored Directories
Ignored Directories
Both file tree and fuzzy finder skip common large directories:
.git,node_modules,target__pycache__,.DS_Store,.vscodedist,build,.next
Efficient State Updates
Efficient State Updates
- Only modified tabs are marked dirty
- Search results are computed asynchronously
- File operations use async tasks
Extension Points
Rode is designed to be extended in several areas:Language Support
Add new tree-sitter grammars in dependencies and register in
syntax.rsThemes
Add new built-in themes in
theme.rs or load custom Lua themesCommands
Register new commands in the command palette system
Icons
Add file type icons by extending the icon mapping in
icons.rsNext Steps
Building Rode
Learn how to compile Rode from source
Contributing
Guidelines for contributing to Rode