aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-17 08:10:00 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-17 08:10:00 -0400
commiteedf03421e07933cdfd2e0185ab815439f4faf57 (patch)
tree6dfa28bc46512a96ed6f1cb745f03ebe5e30b124
parenta89290006f45ff0caf9ea767ee476508d76f7398 (diff)
Add `Matrix_Type` to build string node
-rw-r--r--src/server/ast.odin8
-rw-r--r--tests/hover_test.odin17
2 files changed, 25 insertions, 0 deletions
diff --git a/src/server/ast.odin b/src/server/ast.odin
index 2bb13d0..f33ac6b 100644
--- a/src/server/ast.odin
+++ b/src/server/ast.odin
@@ -1251,6 +1251,14 @@ build_string_node :: proc(node: ^ast.Node, builder: ^strings.Builder, remove_poi
build_string(n.key, builder, remove_pointers)
strings.write_string(builder, "]")
build_string(n.value, builder, remove_pointers)
+ case ^Matrix_Type:
+ strings.write_string(builder, "matrix")
+ strings.write_string(builder, "[")
+ build_string(n.row_count, builder, remove_pointers)
+ strings.write_string(builder, ",")
+ build_string(n.column_count, builder, remove_pointers)
+ strings.write_string(builder, "]")
+ build_string(n.elem, builder, remove_pointers)
case ^ast.Multi_Pointer_Type:
strings.write_string(builder, "[^]")
build_string(n.elem, builder, remove_pointers)
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 7f209b0..7da1b46 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -4019,6 +4019,23 @@ ast_hover_map_empty_struct_literal :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.m: map[int]struct {}")
}
+
+@(test)
+ast_hover_struct_container_fields :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ F{*}oo :: struct {
+ foo_slice: []int,
+ foo_dynamic: [dynamic]int,
+ foo_array: [5]int,
+ foo_map: map[int]int,
+ foo_matrix: matrix[3,4]int,
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.Foo: struct {\n\tfoo_slice: []int,\n\tfoo_dynamic: [dynamic]int,\n\tfoo_array: [5]int,\n\tfoo_map: map[int]int,\n\tfoo_matrix: matrix[3,4]int,\n}")
+}
+
/*
Waiting for odin fix