summaryrefslogtreecommitdiff
path: root/support/texlab/src/symbol/latex_section/equation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/src/symbol/latex_section/equation.rs')
-rw-r--r--support/texlab/src/symbol/latex_section/equation.rs36
1 files changed, 18 insertions, 18 deletions
diff --git a/support/texlab/src/symbol/latex_section/equation.rs b/support/texlab/src/symbol/latex_section/equation.rs
index 4c2fcbe295..2889aefd4d 100644
--- a/support/texlab/src/symbol/latex_section/equation.rs
+++ b/support/texlab/src/symbol/latex_section/equation.rs
@@ -1,41 +1,41 @@
use super::{label_name, selection_range};
-use crate::symbol::{LatexSymbol, LatexSymbolKind};
-use crate::syntax::*;
-use crate::workspace::*;
-use lsp_types::Range;
+use crate::{
+ feature::DocumentView,
+ outline::OutlineContext,
+ protocol::Range,
+ symbol::types::{LatexSymbol, LatexSymbolKind},
+ syntax::latex,
+};
-pub fn symbols(view: &DocumentView, tree: &LatexSyntaxTree) -> Vec<LatexSymbol> {
+pub fn symbols(view: &DocumentView, table: &latex::SymbolTable) -> Vec<LatexSymbol> {
let mut symbols = Vec::new();
- for equation in &tree.math.equations {
- symbols.push(make_symbol(view, tree, equation.range()));
+ for equation in &table.equations {
+ symbols.push(make_symbol(view, table, equation.range(&table)));
}
- for equation in &tree.env.environments {
- if equation.left.is_math() {
- symbols.push(make_symbol(view, tree, equation.range()));
+ for equation in &table.environments {
+ if equation.left.is_math(&table) {
+ symbols.push(make_symbol(view, table, equation.range(&table)));
}
}
symbols
}
-fn make_symbol(view: &DocumentView, tree: &LatexSyntaxTree, full_range: Range) -> LatexSymbol {
- let label = tree.find_label_by_range(full_range);
+fn make_symbol(view: &DocumentView, table: &latex::SymbolTable, full_range: Range) -> LatexSymbol {
+ let label = table.find_label_by_range(full_range);
- let name = match label
- .as_ref()
- .and_then(|label| OutlineContext::find_number(view, label))
- {
+ let name = match label.and_then(|label| OutlineContext::find_number(view, table, *label)) {
Some(num) => format!("Equation ({})", num),
None => "Equation".to_owned(),
};
LatexSymbol {
name,
- label: label_name(label),
+ label: label_name(table, label),
kind: LatexSymbolKind::Equation,
deprecated: false,
full_range,
- selection_range: selection_range(full_range, label),
+ selection_range: selection_range(table, full_range, label),
children: Vec::new(),
}
}