aboutsummaryrefslogtreecommitdiff
path: root/src/server/hover.odin
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2024-04-15 23:20:50 +0200
committerLaytan Laats <laytanlaats@hotmail.com>2024-04-15 23:20:50 +0200
commit25de95df4262c318de7ded5bdc5ca027ab6d4872 (patch)
tree11a8d879f9182a70bd8ef54283344266b04667db /src/server/hover.odin
parentaa1aabda1cce68a6038c48429cc759f09ad2ebab (diff)
support bit_fields
They are pretty similar to structs (just a bit simpler) so I piggy backed of that a lot here, added some basic tests and tested the formatting myself.
Diffstat (limited to 'src/server/hover.odin')
-rw-r--r--src/server/hover.odin38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin
index c3dccbc..566b41c 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -165,6 +165,26 @@ get_hover_information :: proc(
}
}
}
+ } else if v, ok := comp_symbol.value.(SymbolBitFieldValue); ok {
+ for name, i in v.names {
+ if name == field.name {
+ if symbol, ok := resolve_type_expression(
+ &ast_context,
+ v.types[i],
+ ); ok {
+ symbol.name = name
+ symbol.pkg = comp_symbol.name
+ symbol.signature = common.node_to_string(
+ v.types[i],
+ )
+ hover.contents = write_hover_content(
+ &ast_context,
+ symbol,
+ )
+ return hover, true, true
+ }
+ }
+ }
}
}
}
@@ -268,6 +288,24 @@ get_hover_information :: proc(
}
}
}
+ case SymbolBitFieldValue:
+ for name, i in v.names {
+ if name == field {
+ if symbol, ok := resolve_type_expression(
+ &ast_context,
+ v.types[i],
+ ); ok {
+ symbol.name = name
+ symbol.pkg = selector.name
+ symbol.signature = common.node_to_string(v.types[i])
+ hover.contents = write_hover_content(
+ &ast_context,
+ symbol,
+ )
+ return hover, true, true
+ }
+ }
+ }
case SymbolPackageValue:
if position_context.field != nil {
if ident, ok := position_context.field.derived.(^ast.Ident);