New themes
This commit is contained in:
38
src/app.rs
38
src/app.rs
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user