blob: 7ea26d50c2a13e53f18b5cd99ea88695b12b3945 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
use rowan::ast::AstNode;
use crate::{
syntax::latex,
util::{cursor::CursorContext, lang_data::LANGUAGE_DATA},
};
use super::builder::CompletionBuilder;
pub fn complete<'db>(
context: &'db CursorContext,
builder: &mut CompletionBuilder<'db>,
) -> Option<()> {
let (_, range, group) = context.find_curly_group_word_list()?;
let import = latex::TikzLibraryImport::cast(group.syntax().parent()?)?;
if import.command()?.text() == "\\usepgflibrary" {
for name in &LANGUAGE_DATA.pgf_libraries {
builder.tikz_library(range, name);
}
} else {
for name in &LANGUAGE_DATA.tikz_libraries {
builder.tikz_library(range, name);
}
}
Some(())
}
|