aboutsummaryrefslogtreecommitdiff
path: root/src/server/collector.odin
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-03 10:11:39 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-03 13:41:09 -0400
commit7c8439ef9ab2243339583a492eac0c867a0b1d4e (patch)
tree21f49eb4b705bba96844340da457a8625b4502f7 /src/server/collector.odin
parentfd621d7628333e0bc5c0fc75f2faeb51ab12c2df (diff)
Add documentation to enum fields
Diffstat (limited to 'src/server/collector.odin')
-rw-r--r--src/server/collector.odin12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/server/collector.odin b/src/server/collector.odin
index 6bad491..37ba74c 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -135,7 +135,7 @@ collect_struct_fields :: proc(
file: ast.File,
) -> SymbolStructValue {
b := symbol_struct_value_builder_make(collection.allocator)
- construct_struct_field_docs(file, struct_type)
+ construct_struct_field_docs(file, struct_type, collection.allocator)
for field in struct_type.fields.list {
for n in field.names {
@@ -174,7 +174,7 @@ collect_bit_field_fields :: proc(
package_map: map[string]string,
file: ast.File,
) -> SymbolBitFieldValue {
- construct_bit_field_field_docs(file, bit_field_type)
+ construct_bit_field_field_docs(file, bit_field_type, collection.allocator)
names := make([dynamic]string, 0, len(bit_field_type.fields), collection.allocator)
types := make([dynamic]^ast.Expr, 0, len(bit_field_type.fields), collection.allocator)
ranges := make([dynamic]common.Range, 0, len(bit_field_type.fields), collection.allocator)
@@ -227,11 +227,17 @@ collect_enum_fields :: proc(
append(&values, clone_type(value, collection.allocator, &collection.unique_strings))
}
+ temp_docs, temp_comments := get_field_docs_and_comments(file, enum_type.fields, context.temp_allocator)
+ docs := clone_dynamic_array(temp_docs, collection.allocator, &collection.unique_strings)
+ comments := clone_dynamic_array(temp_comments, collection.allocator, &collection.unique_strings)
+
value := SymbolEnumValue {
names = names[:],
ranges = ranges[:],
values = values[:],
base_type = clone_type(enum_type.base_type, collection.allocator, &collection.unique_strings),
+ comments = comments[:],
+ docs = docs[:],
}
return value
@@ -633,7 +639,7 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri
symbol.type = token_type
symbol.doc = get_doc(expr.docs, collection.allocator)
symbol.uri = get_index_unique_string(collection, uri)
- comment := get_file_comment(file, symbol.range.start.line + 1)
+ comment, _ := get_file_comment(file, symbol.range.start.line + 1)
symbol.comment = strings.clone(get_comment(comment), collection.allocator)
symbol.flags |= {.Distinct}