1mod autocomplete;
2pub(crate) use self::autocomplete::build as build_autocomplete;
3
4use anyhow::{anyhow, Context as _, Result};
5
6use crate::alloc::borrow::Cow;
7use crate::doc::Artifacts;
8
9mod embed {
10 #[cfg(debug_assertions)]
11 use rust_alloc::boxed::Box;
12 #[cfg(debug_assertions)]
13 use rust_alloc::string::String;
14
15 use rust_embed::RustEmbed;
16
17 #[derive(RustEmbed)]
18 #[folder = "src/ace/static"]
19 pub(super) struct Assets;
20}
21
22pub(crate) fn theme(artifacts: &mut Artifacts) -> Result<()> {
23 for name in ["rune-mode.js", "rune-highlight-rules.js"] {
24 artifacts.asset(false, name, || {
25 let file = embed::Assets::get(name).with_context(|| anyhow!("missing {name}"))?;
26 Ok(Cow::try_from(file.data)?)
27 })?;
28 }
29
30 Ok(())
31}