summaryrefslogtreecommitdiff
path: root/support/texlab/crates/base-db/src
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/crates/base-db/src')
-rw-r--r--support/texlab/crates/base-db/src/diagnostics/bib.rs4
-rw-r--r--support/texlab/crates/base-db/src/graph.rs4
-rw-r--r--support/texlab/crates/base-db/src/semantics/tex.rs14
-rw-r--r--support/texlab/crates/base-db/src/workspace.rs3
4 files changed, 14 insertions, 11 deletions
diff --git a/support/texlab/crates/base-db/src/diagnostics/bib.rs b/support/texlab/crates/base-db/src/diagnostics/bib.rs
index f931a43c51..67fcf412ad 100644
--- a/support/texlab/crates/base-db/src/diagnostics/bib.rs
+++ b/support/texlab/crates/base-db/src/diagnostics/bib.rs
@@ -41,8 +41,6 @@ fn analyze_entry(document: &mut Document, entry: bibtex::Entry) {
range: TextRange::empty(entry.syntax().text_range().end()),
code: ErrorCode::ExpectingRCurly,
});
-
- return;
}
}
@@ -63,7 +61,5 @@ fn analyze_field(document: &mut Document, field: bibtex::Field) {
range: field.name_token().unwrap().text_range(),
code,
});
-
- return;
}
}
diff --git a/support/texlab/crates/base-db/src/graph.rs b/support/texlab/crates/base-db/src/graph.rs
index b16245e011..5e727d2bd2 100644
--- a/support/texlab/crates/base-db/src/graph.rs
+++ b/support/texlab/crates/base-db/src/graph.rs
@@ -108,7 +108,7 @@ impl<'a> Graph<'a> {
let new_base_dir = link
.base_dir
.as_deref()
- .and_then(|path| base_dir.join(&path).ok())
+ .and_then(|path| base_dir.join(path).ok())
.unwrap_or_else(|| base_dir.clone());
let weight = Some(EdgeWeight {
@@ -148,7 +148,7 @@ impl<'a> Graph<'a> {
path.set_extension(extension);
let Some(target_uri) = path.file_name()
.and_then(OsStr::to_str)
- .and_then(|name| self.workspace.output_dir(base_dir).join(&name).ok()) else { return };
+ .and_then(|name| self.workspace.output_dir(base_dir).join(name).ok()) else { return };
match self.workspace.lookup(&target_uri) {
Some(target) => {
diff --git a/support/texlab/crates/base-db/src/semantics/tex.rs b/support/texlab/crates/base-db/src/semantics/tex.rs
index 46c805ba8a..1445ae12e7 100644
--- a/support/texlab/crates/base-db/src/semantics/tex.rs
+++ b/support/texlab/crates/base-db/src/semantics/tex.rs
@@ -105,6 +105,7 @@ impl Semantics {
fn process_label_definition(&mut self, label: latex::LabelDefinition) {
let Some(name) = label.name().and_then(|group| group.key()) else { return };
+ let full_range = latex::small_range(&label);
let mut objects = Vec::new();
for node in label.syntax().ancestors() {
if let Some(section) = latex::Section::cast(node.clone()) {
@@ -169,27 +170,32 @@ impl Semantics {
kind: LabelKind::Definition,
name: Span::from(&name),
targets: objects,
+ full_range,
});
}
fn process_label_reference(&mut self, label: latex::LabelReference) {
let Some(name_list) = label.name_list() else { return };
+ let full_range = latex::small_range(&label);
for name in name_list.keys() {
self.labels.push(Label {
kind: LabelKind::Reference,
name: Span::from(&name),
targets: Vec::new(),
+ full_range,
});
}
}
fn process_label_reference_range(&mut self, label: latex::LabelReferenceRange) {
+ let full_range = latex::small_range(&label);
if let Some(from) = label.from().and_then(|group| group.key()) {
self.labels.push(Label {
kind: LabelKind::ReferenceRange,
name: Span::from(&from),
targets: Vec::new(),
+ full_range,
});
}
@@ -198,6 +204,7 @@ impl Semantics {
kind: LabelKind::ReferenceRange,
name: Span::from(&to),
targets: Vec::new(),
+ full_range,
});
}
}
@@ -216,13 +223,11 @@ impl Semantics {
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
- .heading()
- .and_then(|group| group.content_text()) else { return };
+ let Some(heading) = theorem_def.heading() else { return };
self.theorem_definitions.push(TheoremDefinition {
name: Span::from(&name),
- heading: description,
+ heading,
});
}
}
@@ -265,6 +270,7 @@ pub struct Label {
pub kind: LabelKind,
pub name: Span,
pub targets: Vec<LabelTarget>,
+ pub full_range: TextRange,
}
#[derive(Debug, Clone)]
diff --git a/support/texlab/crates/base-db/src/workspace.rs b/support/texlab/crates/base-db/src/workspace.rs
index 581d93cfc3..58c7567f9d 100644
--- a/support/texlab/crates/base-db/src/workspace.rs
+++ b/support/texlab/crates/base-db/src/workspace.rs
@@ -75,7 +75,8 @@ impl Workspace {
Cow::Owned(text) => text,
};
- Ok(self.open(uri, text, language, owner, LineCol { line: 0, col: 0 }))
+ self.open(uri, text, language, owner, LineCol { line: 0, col: 0 });
+ Ok(())
}
pub fn edit(&mut self, uri: &Url, delete: TextRange, insert: &str) -> Option<()> {