blob: 5f09142cfd68faeefe04dd3aed53aef17c295dfe (
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
|
use rowan::ast::AstNode;
use syntax::latex;
use crate::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(())
}
|