summaryrefslogtreecommitdiff
path: root/support/texlab/crates/completion/src/providers
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-05-26 03:01:14 +0000
committerNorbert Preining <norbert@preining.info>2024-05-26 03:01:14 +0000
commita6ca78f24091e7023516b4761d400b3699f82937 (patch)
treec232a264a2fbf391f9d10cf330ce611f8a0e64ab /support/texlab/crates/completion/src/providers
parent737e568a228eca50e9aeabe3116e1fe8116d27d5 (diff)
CTAN sync 202405260301
Diffstat (limited to 'support/texlab/crates/completion/src/providers')
-rw-r--r--support/texlab/crates/completion/src/providers/argument.rs2
-rw-r--r--support/texlab/crates/completion/src/providers/color.rs2
-rw-r--r--support/texlab/crates/completion/src/providers/color_model.rs2
-rw-r--r--support/texlab/crates/completion/src/providers/command.rs4
-rw-r--r--support/texlab/crates/completion/src/providers/environment.rs6
-rw-r--r--support/texlab/crates/completion/src/providers/glossary.rs2
-rw-r--r--support/texlab/crates/completion/src/providers/import.rs8
-rw-r--r--support/texlab/crates/completion/src/providers/include.rs6
-rw-r--r--support/texlab/crates/completion/src/providers/tikz_library.rs2
9 files changed, 16 insertions, 18 deletions
diff --git a/support/texlab/crates/completion/src/providers/argument.rs b/support/texlab/crates/completion/src/providers/argument.rs
index 6637cecdd6..a9c8f4304b 100644
--- a/support/texlab/crates/completion/src/providers/argument.rs
+++ b/support/texlab/crates/completion/src/providers/argument.rs
@@ -37,7 +37,7 @@ pub fn complete_arguments<'a>(
.filter(|(i, _)| *i == index)
{
for arg in &param.0 {
- if let Some(score) = builder.matcher.score(&arg.name, &cursor.text) {
+ if let Some(score) = builder.matcher.score(arg.name, &cursor.text) {
let data = CompletionItemData::Argument(ArgumentData(arg));
builder
.items
diff --git a/support/texlab/crates/completion/src/providers/color.rs b/support/texlab/crates/completion/src/providers/color.rs
index cbdd38dc32..8be1b50555 100644
--- a/support/texlab/crates/completion/src/providers/color.rs
+++ b/support/texlab/crates/completion/src/providers/color.rs
@@ -14,7 +14,7 @@ pub fn complete_colors<'a>(
latex::ColorReference::cast(group.syntax().parent()?)?;
for name in COLORS {
- if let Some(score) = builder.matcher.score(&name, &cursor.text) {
+ if let Some(score) = builder.matcher.score(name, &cursor.text) {
let data = CompletionItemData::Color(name);
builder
.items
diff --git a/support/texlab/crates/completion/src/providers/color_model.rs b/support/texlab/crates/completion/src/providers/color_model.rs
index 4b991c4807..80970b1913 100644
--- a/support/texlab/crates/completion/src/providers/color_model.rs
+++ b/support/texlab/crates/completion/src/providers/color_model.rs
@@ -14,7 +14,7 @@ pub fn complete_color_models<'a>(
let cursor = check_color_definition(params).or_else(|| check_color_definition_set(params))?;
for name in MODEL_NAMES {
- if let Some(score) = builder.matcher.score(&name, &cursor.text) {
+ if let Some(score) = builder.matcher.score(name, &cursor.text) {
let data = CompletionItemData::ColorModel(name);
builder
.items
diff --git a/support/texlab/crates/completion/src/providers/command.rs b/support/texlab/crates/completion/src/providers/command.rs
index f404d42ab3..34f8876e1f 100644
--- a/support/texlab/crates/completion/src/providers/command.rs
+++ b/support/texlab/crates/completion/src/providers/command.rs
@@ -44,7 +44,7 @@ impl<'a, 'b> Processor<'a, 'b> {
pub fn add_delimiters(&mut self) {
for (left, right) in DELIMITERS {
- let Some(score) = self.0.builder.matcher.score(&left, &self.0.cursor.text) else {
+ let Some(score) = self.0.builder.matcher.score(left, &self.0.cursor.text) else {
continue;
};
@@ -68,7 +68,7 @@ impl<'a, 'b> Processor<'a, 'b> {
let data = CompletionItemData::Command(CommandData {
name: &command.name,
glyph: command.glyph.as_deref(),
- image: command.image.as_deref(),
+ image: command.image,
package: Some(package),
});
diff --git a/support/texlab/crates/completion/src/providers/environment.rs b/support/texlab/crates/completion/src/providers/environment.rs
index 393dd100ba..b56377550e 100644
--- a/support/texlab/crates/completion/src/providers/environment.rs
+++ b/support/texlab/crates/completion/src/providers/environment.rs
@@ -21,7 +21,7 @@ pub fn complete_environments<'a>(
.and_then(|env| env.begin())
.and_then(|begin| begin.name())
.and_then(|name| name.key())
- .map_or_else(|| String::new(), |name| name.to_string());
+ .map_or_else(String::new, |name| name.to_string());
let mut proc = Processor {
inner: ProviderContext {
@@ -48,7 +48,7 @@ impl<'a, 'b> Processor<'a, 'b> {
for package in included_packages(&self.inner.params.feature) {
let envs_with_score = package.environments.iter().filter_map(|env| {
let matcher = &self.inner.builder.matcher;
- let score = matcher.score(&env, &self.inner.cursor.text)?;
+ let score = matcher.score(env, &self.inner.cursor.text)?;
Some((*env, score))
});
@@ -76,7 +76,7 @@ impl<'a, 'b> Processor<'a, 'b> {
{
let matcher = &self.inner.builder.matcher;
let name = theorem.name.text.as_str();
- if let Some(score) = matcher.score(&name, &self.inner.cursor.text) {
+ if let Some(score) = matcher.score(name, &self.inner.cursor.text) {
let data = CompletionItemData::Environment(EnvironmentData {
name,
package: None,
diff --git a/support/texlab/crates/completion/src/providers/glossary.rs b/support/texlab/crates/completion/src/providers/glossary.rs
index c22f5b5888..d01d62a511 100644
--- a/support/texlab/crates/completion/src/providers/glossary.rs
+++ b/support/texlab/crates/completion/src/providers/glossary.rs
@@ -58,7 +58,7 @@ impl<'a, 'b> Processor<'a, 'b> {
for name in data
.root_node()
.descendants()
- .filter_map(|node| extract(node))
+ .filter_map(&extract)
.filter_map(|name| name.key())
.map(|name| name.to_string())
{
diff --git a/support/texlab/crates/completion/src/providers/import.rs b/support/texlab/crates/completion/src/providers/import.rs
index c506026a99..c0f608f9d2 100644
--- a/support/texlab/crates/completion/src/providers/import.rs
+++ b/support/texlab/crates/completion/src/providers/import.rs
@@ -29,13 +29,13 @@ pub fn complete_imports<'a>(
file_names.insert(file_name);
let stem = &file_name[0..file_name.len() - 4];
if kind == latex::PACKAGE_INCLUDE {
- if let Some(score) = builder.matcher.score(&stem, &cursor.text) {
+ if let Some(score) = builder.matcher.score(stem, &cursor.text) {
let data = CompletionItemData::Package(stem);
builder
.items
.push(CompletionItem::new_simple(score, cursor.range, data));
}
- } else if let Some(score) = builder.matcher.score(&stem, &cursor.text) {
+ } else if let Some(score) = builder.matcher.score(stem, &cursor.text) {
let data = CompletionItemData::DocumentClass(stem);
builder
.items
@@ -51,13 +51,13 @@ pub fn complete_imports<'a>(
{
let stem = &file_name[0..file_name.len() - 4];
if kind == latex::PACKAGE_INCLUDE {
- if let Some(score) = builder.matcher.score(&stem, &cursor.text) {
+ if let Some(score) = builder.matcher.score(stem, &cursor.text) {
let data = CompletionItemData::Package(stem);
builder
.items
.push(CompletionItem::new_simple(score, cursor.range, data));
}
- } else if let Some(score) = builder.matcher.score(&stem, &cursor.text) {
+ } else if let Some(score) = builder.matcher.score(stem, &cursor.text) {
let data = CompletionItemData::DocumentClass(stem);
builder
.items
diff --git a/support/texlab/crates/completion/src/providers/include.rs b/support/texlab/crates/completion/src/providers/include.rs
index 60c432d097..d0a042252f 100644
--- a/support/texlab/crates/completion/src/providers/include.rs
+++ b/support/texlab/crates/completion/src/providers/include.rs
@@ -19,9 +19,7 @@ pub fn complete_includes<'a>(
params: &'a CompletionParams<'a>,
builder: &mut CompletionBuilder<'a>,
) -> Option<()> {
- if params.feature.document.path.is_none() {
- return None;
- }
+ params.feature.document.path.as_ref()?;
let (cursor, group) = find_curly_group_word_list(params)?;
@@ -115,7 +113,7 @@ fn current_dir(
graphics_path: Option<&str>,
) -> Option<PathBuf> {
let workspace = &params.workspace;
- let parent = deps::parents(&workspace, params.document)
+ let parent = deps::parents(workspace, params.document)
.iter()
.next()
.map_or(params.document, Clone::clone);
diff --git a/support/texlab/crates/completion/src/providers/tikz_library.rs b/support/texlab/crates/completion/src/providers/tikz_library.rs
index 10a0aa44ba..4c3d7e8955 100644
--- a/support/texlab/crates/completion/src/providers/tikz_library.rs
+++ b/support/texlab/crates/completion/src/providers/tikz_library.rs
@@ -21,7 +21,7 @@ pub fn complete_tikz_libraries<'a>(
};
for name in libraries {
- if let Some(score) = builder.matcher.score(&name, &cursor.text) {
+ if let Some(score) = builder.matcher.score(name, &cursor.text) {
let data = CompletionItemData::TikzLibrary(name);
builder
.items