Skip to content

Commit bdd4760

Browse files
committed
feat: Add completion for builtin types with documentation
closes #80
1 parent 4f3a820 commit bdd4760

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+109
-70
lines changed

src/docs.rs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
use std::{collections::HashMap, sync::LazyLock};
2+
3+
macro_rules! docmap_builtin {
4+
($name:literal) => {
5+
($name, include_str!(concat!("docs/builtin/", $name, ".md")))
6+
};
7+
}
8+
9+
macro_rules! docmap_wellknown {
10+
($name:literal) => {
11+
(
12+
concat!("google.protobuf.", $name),
13+
include_str!(concat!("docs/wellknown/", $name, ".md")),
14+
)
15+
};
16+
}
17+
18+
pub static BUITIN: LazyLock<HashMap<&'static str, &'static str>> = LazyLock::new(|| {
19+
HashMap::from([
20+
docmap_builtin!("int32"),
21+
docmap_builtin!("int64"),
22+
docmap_builtin!("uint32"),
23+
docmap_builtin!("uint64"),
24+
docmap_builtin!("sint32"),
25+
docmap_builtin!("sint64"),
26+
docmap_builtin!("fixed32"),
27+
docmap_builtin!("fixed64"),
28+
docmap_builtin!("sfixed32"),
29+
docmap_builtin!("sfixed64"),
30+
docmap_builtin!("float"),
31+
docmap_builtin!("double"),
32+
docmap_builtin!("string"),
33+
docmap_builtin!("bytes"),
34+
docmap_builtin!("bool"),
35+
docmap_builtin!("default"),
36+
])
37+
});
38+
39+
pub static WELLKNOWN: LazyLock<HashMap<&'static str, &'static str>> = LazyLock::new(|| {
40+
HashMap::from([
41+
docmap_wellknown!("Any"),
42+
docmap_wellknown!("Api"),
43+
docmap_wellknown!("BoolValue"),
44+
docmap_wellknown!("BytesValue"),
45+
docmap_wellknown!("DoubleValue"),
46+
docmap_wellknown!("Duration"),
47+
docmap_wellknown!("Empty"),
48+
docmap_wellknown!("Enum"),
49+
docmap_wellknown!("EnumValue"),
50+
docmap_wellknown!("Field"),
51+
docmap_wellknown!("Field.Cardinality"),
52+
docmap_wellknown!("Field.Kind"),
53+
docmap_wellknown!("FieldMask"),
54+
docmap_wellknown!("FloatValue"),
55+
docmap_wellknown!("Int32Value"),
56+
docmap_wellknown!("Int64Value"),
57+
docmap_wellknown!("ListValue"),
58+
docmap_wellknown!("Method"),
59+
docmap_wellknown!("Mixin"),
60+
docmap_wellknown!("NullValue"),
61+
docmap_wellknown!("Option"),
62+
docmap_wellknown!("SourceContext"),
63+
docmap_wellknown!("StringValue"),
64+
docmap_wellknown!("Struct"),
65+
docmap_wellknown!("Syntax"),
66+
docmap_wellknown!("Timestamp"),
67+
docmap_wellknown!("Type"),
68+
docmap_wellknown!("UInt32Value"),
69+
docmap_wellknown!("UInt64Value"),
70+
docmap_wellknown!("Value"),
71+
])
72+
});

0 commit comments

Comments
 (0)