summaryrefslogtreecommitdiff
path: root/support/texlab/crates/base-db/src/semantics/tex.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/crates/base-db/src/semantics/tex.rs')
-rw-r--r--support/texlab/crates/base-db/src/semantics/tex.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/support/texlab/crates/base-db/src/semantics/tex.rs b/support/texlab/crates/base-db/src/semantics/tex.rs
index 2b506ee878..6e238737b0 100644
--- a/support/texlab/crates/base-db/src/semantics/tex.rs
+++ b/support/texlab/crates/base-db/src/semantics/tex.rs
@@ -9,8 +9,8 @@ use super::Span;
pub struct Semantics {
pub links: Vec<Link>,
pub labels: Vec<Label>,
- pub commands: Vec<(TextRange, String)>,
- pub environments: FxHashSet<String>,
+ pub commands: Vec<Span>,
+ pub environments: Vec<Span>,
pub theorem_definitions: Vec<TheoremDefinition>,
pub graphics_paths: FxHashSet<String>,
pub can_be_root: bool,
@@ -29,14 +29,12 @@ impl Semantics {
let range = token.text_range();
let range = TextRange::new(range.start() + "\\".text_len(), range.end());
let text = String::from(&token.text()[1..]);
- self.commands.push((range, text));
+ self.commands.push(Span { range, text });
}
}
};
}
- self.can_be_compiled = self.environments.contains("document");
-
self.can_be_root = self.can_be_compiled
&& !self
.links
@@ -208,19 +206,21 @@ impl Semantics {
.and_then(|begin| begin.name())
.and_then(|group| group.key()) else { return };
- self.environments.insert(String::from(name.syntax().text()));
+ let name = Span::from(&name);
+ self.can_be_compiled = self.can_be_compiled || name.text == "document";
+ self.environments.push(name);
}
fn process_theorem_definition(&mut self, theorem_def: latex::TheoremDefinition) {
let Some(name) = theorem_def.name().and_then(|name| name.key()) else { return };
let Some(description) = theorem_def
- .description()
+ .heading()
.and_then(|group| group.content_text()) else { return };
self.theorem_definitions.push(TheoremDefinition {
name: Span::from(&name),
- description,
+ heading: description,
});
}
}
@@ -288,5 +288,5 @@ pub enum LabelObject {
#[derive(Debug, Clone)]
pub struct TheoremDefinition {
pub name: Span,
- pub description: String,
+ pub heading: String,
}