This repository has been archived on 2026-05-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
el-ide-retired/crates/el-ide-server/src/embed.rs
T
Will Anderson 376fbb41b3 El IDE: 10-round pass — syntax highlighting, file browser, runner, completion, split panes, find/replace, settings, minimap
Round 1: Fix dependency paths (../el/crates → ../el/engrams), verify build
Round 2: Enhanced syntax highlighting — function call detection, all El keywords (activate, sealed, parallel, deploy, etc.)
Round 3: Full El keyword set in CodeMirror tokenizer and completions; 50+ builtin function completions with type signatures
Round 4: File system integration — mkdir, rename, delete, file tree search; git status badges
Round 5: Runner integration — Ctrl+R shortcut, SSE streaming output, clickable error lines with jump-to-line
Round 6: Error highlighting with accurate line/col from lexer/parser spans; diagnostic dedup
Round 7: Find/replace panel; Ctrl+G go-to-line; toggle line comment; word-wrap compartment fix
Round 8: Code completion — 50+ builtins, keyword completions, snippet completions, server snippet integration
Round 9: Resizable panels — file tree drag-resize + collapse (Ctrl+B), type-graph drag-resize, bottom panel toggle (Ctrl+J), width persistence
Round 10: Settings API (GET/POST/DELETE /api/settings, ~/.el-ide/settings.json); frontend wired to API with debounced save; theme persistence
Round 11: Minimap click-to-jump and drag-to-scroll
Round 12: Command palette — added Go To Line, Toggle Word Wrap/Minimap/File Tree/Bottom Panel, font size commands, New File, Select Next Occurrence
Round 13: Multi-cursor — Ctrl+D select next occurrence, EditorSelection exposed for multi-range selection
2026-04-29 04:34:08 -05:00

50 lines
1.4 KiB
Rust

//! Embedded static assets via rust-embed.
use axum::{
http::{header, StatusCode},
response::{IntoResponse, Response},
};
use rust_embed::RustEmbed;
#[derive(RustEmbed)]
#[folder = "../../ide/"]
pub struct Assets;
/// Serve `index.html` at the root path.
pub async fn serve_index() -> impl IntoResponse {
serve_file("index.html")
}
/// Fallback handler — serves index.html for unknown paths (SPA routing).
pub async fn fallback() -> impl IntoResponse {
serve_file("index.html")
}
fn serve_file(path: &str) -> Response {
match Assets::get(path) {
Some(content) => {
let mime = mime_guess::from_path(path)
.first_or_octet_stream()
.to_string();
(
StatusCode::OK,
[(header::CONTENT_TYPE, mime)],
content.data.to_vec(),
)
.into_response()
}
None => {
// For SPA routing, fall back to index.html
match Assets::get("index.html") {
Some(content) => (
StatusCode::OK,
[(header::CONTENT_TYPE, "text/html; charset=utf-8".to_string())],
content.data.to_vec(),
)
.into_response(),
None => StatusCode::NOT_FOUND.into_response(),
}
}
}
}