summaryrefslogtreecommitdiff
path: root/support/texlab/src/features/completion/tikz_library.rs
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-12-30 03:01:26 +0000
committerNorbert Preining <norbert@preining.info>2022-12-30 03:01:26 +0000
commit844019377157163b461e0fd4a66592e61963a530 (patch)
tree32f61991c6a5acc3a3359ffc2cdefdd2aa004268 /support/texlab/src/features/completion/tikz_library.rs
parent55c69feeef908f49007708be194b7bb1c607f302 (diff)
CTAN sync 202212300301
Diffstat (limited to 'support/texlab/src/features/completion/tikz_library.rs')
-rw-r--r--support/texlab/src/features/completion/tikz_library.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/support/texlab/src/features/completion/tikz_library.rs b/support/texlab/src/features/completion/tikz_library.rs
index bf15695722..7ea26d50c2 100644
--- a/support/texlab/src/features/completion/tikz_library.rs
+++ b/support/texlab/src/features/completion/tikz_library.rs
@@ -1,13 +1,15 @@
-use lsp_types::CompletionParams;
use rowan::ast::AstNode;
-use crate::{features::cursor::CursorContext, syntax::latex, LANGUAGE_DATA};
+use crate::{
+ syntax::latex,
+ util::{cursor::CursorContext, lang_data::LANGUAGE_DATA},
+};
-use super::types::{InternalCompletionItem, InternalCompletionItemData};
+use super::builder::CompletionBuilder;
-pub fn complete_tikz_libraries<'a>(
- context: &'a CursorContext<CompletionParams>,
- items: &mut Vec<InternalCompletionItem<'a>>,
+pub fn complete<'db>(
+ context: &'db CursorContext,
+ builder: &mut CompletionBuilder<'db>,
) -> Option<()> {
let (_, range, group) = context.find_curly_group_word_list()?;
@@ -15,17 +17,11 @@ pub fn complete_tikz_libraries<'a>(
if import.command()?.text() == "\\usepgflibrary" {
for name in &LANGUAGE_DATA.pgf_libraries {
- items.push(InternalCompletionItem::new(
- range,
- InternalCompletionItemData::PgfLibrary { name },
- ));
+ builder.tikz_library(range, name);
}
} else {
for name in &LANGUAGE_DATA.tikz_libraries {
- items.push(InternalCompletionItem::new(
- range,
- InternalCompletionItemData::TikzLibrary { name },
- ));
+ builder.tikz_library(range, name);
}
}