diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2023-11-06 21:37:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-06 21:37:50 +0100 |
| commit | c0f6d2004afebfa9412ba0c2d598ef8287197c42 (patch) | |
| tree | 4bb034ca671e7d1982a306f5aecfc4f78a01841d /crates/typst-ide/src | |
| parent | 8fd546760c7c425398f0114997c8085a481d8d2a (diff) | |
Content rework 2 - Electric Boogaloo (#2504)
Diffstat (limited to 'crates/typst-ide/src')
| -rw-r--r-- | crates/typst-ide/src/analyze.rs | 8 | ||||
| -rw-r--r-- | crates/typst-ide/src/complete.rs | 4 | ||||
| -rw-r--r-- | crates/typst-ide/src/tooltip.rs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/crates/typst-ide/src/analyze.rs b/crates/typst-ide/src/analyze.rs index 32f3df0d..4d12e1c5 100644 --- a/crates/typst-ide/src/analyze.rs +++ b/crates/typst-ide/src/analyze.rs @@ -85,10 +85,10 @@ pub fn analyze_labels( // Labels in the document. for elem in introspector.all() { - let Some(label) = elem.label().cloned() else { continue }; + let Some(label) = elem.label() else { continue }; let details = elem - .field("caption") - .or_else(|| elem.field("body")) + .get_by_name("caption") + .or_else(|| elem.get_by_name("body")) .and_then(|field| match field { Value::Content(content) => Some(content), _ => None, @@ -103,7 +103,7 @@ pub fn analyze_labels( // Bibliography keys. for (key, detail) in (items.bibliography_keys)(introspector.track()) { - output.push((Label(key), detail)); + output.push((Label::new(&key), detail)); } (output, split) diff --git a/crates/typst-ide/src/complete.rs b/crates/typst-ide/src/complete.rs index 8da50e5a..32505585 100644 --- a/crates/typst-ide/src/complete.rs +++ b/crates/typst-ide/src/complete.rs @@ -1119,11 +1119,11 @@ impl<'a> CompletionContext<'a> { eco_format!( "{}{}{}", if open { "<" } else { "" }, - label.0, + label.as_str(), if close { ">" } else { "" } ) }), - label: label.0, + label: label.as_str().into(), detail, }); } diff --git a/crates/typst-ide/src/tooltip.rs b/crates/typst-ide/src/tooltip.rs index d358f851..f90f2aea 100644 --- a/crates/typst-ide/src/tooltip.rs +++ b/crates/typst-ide/src/tooltip.rs @@ -158,7 +158,7 @@ fn label_tooltip( }; for (label, detail) in analyze_labels(world, frames).0 { - if label.0 == target { + if label.as_str() == target { return Some(Tooltip::Text(detail?)); } } |
