aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2023-09-17 18:55:10 +0200
committerDanielGavin <danielgavin5@hotmail.com>2023-09-17 18:55:10 +0200
commit9575a3e076ab3d8df98d5efc6902ac2dd54edca0 (patch)
treed1fc622cc0d2cee77a95e58c626395e412c7283f
parentbfdbc198ab18ddf67f2e13485cbe79013690e30f (diff)
Fix not writing the bit_set correcty in hover and completion
-rw-r--r--src/server/analysis.odin10
-rw-r--r--tests/hover_test.odin17
2 files changed, 25 insertions, 2 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index b48aaee..b7ff01e 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -4515,7 +4515,15 @@ get_signature :: proc(
ast_context.allocator,
)
case SymbolBitSetValue:
- return common.node_to_string(v.expr)
+ return strings.concatenate(
+ a = {
+ pointer_prefix,
+ "bit_set[",
+ common.node_to_string(v.expr),
+ "]",
+ },
+ allocator = ast_context.allocator,
+ )
case SymbolEnumValue:
if is_variable {
return symbol.name
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 30afc59..fd24603 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -1,7 +1,7 @@
package tests
-import "core:testing"
import "core:fmt"
+import "core:testing"
import test "shared:testing"
@@ -170,3 +170,18 @@ ast_hover_on_sliced_result :: proc(t: ^testing.T) {
test.expect_hover(t, &source, "test.slice: []byte")
}
+
+
+@(test)
+ast_hover_on_bitset_variable :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ test :: proc () {
+ Foo :: enum {A,B,C}
+ derived_{*}bit_set := bit_set[Foo]{}
+ }
+ `,
+ }
+
+ test.expect_hover(&t, &source, "test.derived_bit_set: bit_set[Foo]")
+}