summaryrefslogtreecommitdiff
path: root/library/src/text
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-11 11:46:12 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-11 11:46:12 +0100
commit8e5f446544fd147277ed2e4208c7ea793cc846a7 (patch)
treef8b0143fb3845da6673ca1312f03ab53f0f28a50 /library/src/text
parenta9fdff244aef859449a76e5f762ee7c343a8ddcc (diff)
Autocompletion for raw language tags
Diffstat (limited to 'library/src/text')
-rw-r--r--library/src/text/raw.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs
index 72dd1782..99fb89d2 100644
--- a/library/src/text/raw.rs
+++ b/library/src/text/raw.rs
@@ -103,6 +103,23 @@ pub struct RawNode {
pub lang: Option<EcoString>,
}
+impl RawNode {
+ /// The supported language names and tags.
+ pub fn languages() -> Vec<(&'static str, Vec<&'static str>)> {
+ SYNTAXES
+ .syntaxes()
+ .iter()
+ .map(|syntax| {
+ (
+ syntax.name.as_str(),
+ syntax.file_extensions.iter().map(|s| s.as_str()).collect(),
+ )
+ })
+ .chain([("Typst", vec!["typ"]), ("Typst (code)", vec!["typc"])])
+ .collect()
+ }
+}
+
impl Prepare for RawNode {
fn prepare(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> {
let mut node = self.clone().pack();