aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-03 12:36:27 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-03 19:48:15 -0400
commit8fd95cac8b24ae6311009ea96cc9947a7b430d87 (patch)
treecc8baaac8be25aabfca08e32459b2c385043ca50 /src
parent56a6c4ef51116f9a7e33b9a4b5fda95baaa0f5a0 (diff)
Add enum completion to map keys
Diffstat (limited to 'src')
-rw-r--r--src/server/completion.odin20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 4544143..b4f86a8 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -1196,8 +1196,24 @@ get_implicit_completion :: proc(
symbol, ok = resolve_type_expression(ast_context, position_context.index.expr)
}
- if array, ok := symbol.value.(SymbolFixedArrayValue); ok {
- if enum_value, ok := unwrap_enum(ast_context, array.len); ok {
+ #partial switch v in symbol.value {
+ case SymbolFixedArrayValue:
+ if enum_value, ok := unwrap_enum(ast_context, v.len); ok {
+ for name in enum_value.names {
+ item := CompletionItem {
+ label = name,
+ kind = .EnumMember,
+ detail = name,
+ }
+
+ append(&items, item)
+ }
+
+ list.items = items[:]
+ return
+ }
+ case SymbolMapValue:
+ if enum_value, ok := unwrap_enum(ast_context, v.key); ok {
for name in enum_value.names {
item := CompletionItem {
label = name,