aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin7
-rw-r--r--src/server/hover.odin25
2 files changed, 29 insertions, 3 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 7f0007e..668260b 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -3727,9 +3727,10 @@ unwrap_super_enum :: proc(
for type in symbol_union.types {
symbol := resolve_type_expression(ast_context, type) or_return
- value := symbol.value.(SymbolEnumValue) or_return
- append(&names, ..value.names)
- append(&ranges, ..value.ranges)
+ if value, ok := symbol.value.(SymbolEnumValue); ok {
+ append(&names, ..value.names)
+ append(&ranges, ..value.ranges)
+ }
}
ret_value.names = names[:]
diff --git a/src/server/hover.odin b/src/server/hover.odin
index 9e4e20c..cc3c5b2 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -234,6 +234,31 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
}
}
}
+ } else if position_context.implicit_selector_expr != nil {
+ implicit_selector := position_context.implicit_selector_expr
+ if symbol, ok := resolve_implicit_selector(&ast_context, &position_context, implicit_selector); ok {
+ #partial switch v in symbol.value {
+ case SymbolEnumValue:
+ for name, i in v.names {
+ if strings.compare(name, implicit_selector.field.name) == 0 {
+ symbol.signature = fmt.tprintf(".%s", name)
+ hover.contents = write_hover_content(&ast_context, symbol)
+ return hover, true, true
+ }
+ }
+ case SymbolUnionValue:
+ if enum_value, ok := unwrap_super_enum(&ast_context, v); ok {
+ for name, i in enum_value.names {
+ if strings.compare(name, implicit_selector.field.name) == 0 {
+ symbol.signature = fmt.tprintf(".%s", name)
+ hover.contents = write_hover_content(&ast_context, symbol)
+ return hover, true, true
+ }
+ }
+ }
+ }
+ }
+ return {}, false, true
} else if position_context.identifier != nil {
reset_ast_context(&ast_context)