New themes

This commit is contained in:
2026-02-06 00:19:16 +01:00
parent 51f52be4ce
commit 6ec3a86568
11 changed files with 1178 additions and 46 deletions

View File

@@ -4,7 +4,9 @@ use rand::rngs::StdRng;
use rand::SeedableRng;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use cagire_ratatui::CompletionCandidate;
use crossbeam_channel::Sender;
@@ -25,6 +27,18 @@ use crate::state::{
const STEPS_PER_PAGE: usize = 32;
static COMPLETION_CANDIDATES: LazyLock<Vec<CompletionCandidate>> = LazyLock::new(|| {
model::WORDS
.iter()
.map(|w| CompletionCandidate {
name: w.name.to_string(),
signature: w.stack.to_string(),
description: w.desc.to_string(),
example: w.example.to_string(),
})
.collect()
});
pub struct App {
pub project_state: ProjectState,
pub ui: UiState,
@@ -310,16 +324,7 @@ impl App {
script.lines().map(String::from).collect()
};
self.editor_ctx.editor.set_content(lines);
let candidates = model::WORDS
.iter()
.map(|w| cagire_ratatui::CompletionCandidate {
name: w.name.to_string(),
signature: w.stack.to_string(),
description: w.desc.to_string(),
example: w.example.to_string(),
})
.collect();
self.editor_ctx.editor.set_candidates(candidates);
self.editor_ctx.editor.set_candidates(COMPLETION_CANDIDATES.clone());
self.editor_ctx
.editor
.set_completion_enabled(self.ui.show_completion);
@@ -350,16 +355,7 @@ impl App {
prelude.lines().map(String::from).collect()
};
self.editor_ctx.editor.set_content(lines);
let candidates = model::WORDS
.iter()
.map(|w| cagire_ratatui::CompletionCandidate {
name: w.name.to_string(),
signature: w.stack.to_string(),
description: w.desc.to_string(),
example: w.example.to_string(),
})
.collect();
self.editor_ctx.editor.set_candidates(candidates);
self.editor_ctx.editor.set_candidates(COMPLETION_CANDIDATES.clone());
self.editor_ctx
.editor
.set_completion_enabled(self.ui.show_completion);