aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-26 19:59:55 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-29 15:49:11 -0400
commitca14a7b8462d4f0d996dd502ac7183dc426f4a74 (patch)
tree74d4d77d7b0d010b6f35539b00547e644a3d6bc1 /src/server
parent50c178dab7203b779688861d2443c652e08a8966 (diff)
Update comp lit completions
Diffstat (limited to 'src/server')
-rw-r--r--src/server/completion.odin39
1 files changed, 10 insertions, 29 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 229bd96..24aa323 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -154,7 +154,7 @@ get_completion_list :: proc(
switch completion_type {
case .Comp_Lit:
- get_comp_lit_completion(&ast_context, &position_context, &list)
+ is_incomplete = get_comp_lit_completion(&ast_context, &position_context, &results)
case .Identifier:
is_incomplete = get_identifier_completion(&ast_context, &position_context, &results)
case .Implicit:
@@ -278,10 +278,8 @@ get_directive_completion :: proc(
get_comp_lit_completion :: proc(
ast_context: ^AstContext,
position_context: ^DocumentPositionContext,
- list: ^CompletionList,
-) {
- items := make([dynamic]CompletionItem, context.temp_allocator)
-
+ list: ^[dynamic]CompletionResult,
+) -> bool {
if symbol, ok := resolve_comp_literal(ast_context, position_context); ok {
#partial switch v in symbol.value {
case SymbolStructValue:
@@ -297,14 +295,8 @@ get_comp_lit_completion :: proc(
continue
}
- item := CompletionItem {
- label = name,
- kind = .Field,
- detail = fmt.tprintf("%v.%v: %v", symbol.name, name, node_to_string(v.types[i])),
- documentation = resolved.doc,
- }
-
- append(&items, item)
+ construct_struct_field_symbol(&symbol, symbol.name, v, i)
+ append(list, CompletionResult{symbol = symbol})
}
}
case SymbolBitFieldValue:
@@ -320,14 +312,8 @@ get_comp_lit_completion :: proc(
continue
}
- item := CompletionItem {
- label = name,
- kind = .Field,
- detail = fmt.tprintf("%v.%v: %v", symbol.name, name, node_to_string(v.types[i])),
- documentation = resolved.doc,
- }
-
- append(&items, item)
+ construct_bit_field_field_symbol(&symbol, symbol.name, v, i)
+ append(list, CompletionResult{symbol = symbol})
}
}
case SymbolFixedArrayValue:
@@ -338,20 +324,15 @@ get_comp_lit_completion :: proc(
continue
}
- item := CompletionItem {
- label = name,
- detail = fmt.tprintf(".%s", name),
- documentation = symbol.doc,
- }
-
- append(&items, item)
+ construct_enum_field_symbol(&symbol, v, i)
+ append(list, CompletionResult{symbol = symbol})
}
}
}
}
}
- list.items = items[:]
+ return false
}
get_selector_completion :: proc(