diff options
| -rw-r--r-- | src/server/locals.odin | 33 | ||||
| -rw-r--r-- | tests/hover_test.odin | 14 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/server/locals.odin b/src/server/locals.odin index 4a542bf..272504d 100644 --- a/src/server/locals.odin +++ b/src/server/locals.odin @@ -914,6 +914,39 @@ get_locals_for_range_stmt :: proc( ) } } + case SymbolEnumValue: + if len(stmt.vals) >= 1 { + if ident, ok := unwrap_ident(stmt.vals[0]); ok { + store_local( + ast_context, + ident, + stmt.expr, + ident.pos.offset, + ident.name, + ast_context.non_mutable_only, + false, + {.Mutable}, + symbol.pkg, + false, + ) + } + } + if len(stmt.vals) >= 2 { + if ident, ok := unwrap_ident(stmt.vals[1]); ok { + store_local( + ast_context, + ident, + make_int_ast(ast_context, ident.pos, ident.end), + ident.pos.offset, + ident.name, + ast_context.non_mutable_only, + false, + {.Mutable}, + symbol.pkg, + false, + ) + } + } } } diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 1ee56d4..b598c24 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -5394,6 +5394,20 @@ ast_hover_local_const_binary_expr_with_type :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.foo : i32 : 1 + 2") } + +@(test) +ast_hover_loop_over_enum :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: enum {A, B, C} + main :: proc() { + for f{*}oo in Foo {} + } + + `, + } + test.expect_hover(t, &source, "test.foo: test.Foo") +} /* Waiting for odin fix |