aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2025-06-11 15:05:11 +0200
committerGitHub <noreply@github.com>2025-06-11 15:05:11 +0200
commitf09e5fc3379ae4e706193ee777028c47293c9335 (patch)
treec7bcd770f31d0c95da94b52a2c7587a5524ece98 /tests
parent3f089f4d757e2a705056eb331c74442ab48862aa (diff)
parent2a284808585aa062932e5bf162e4facfd5b8cee2 (diff)
Merge pull request #658 from BradLewis/fix/hover-struct-definitions
Add struct field type to hover information
Diffstat (limited to 'tests')
-rw-r--r--tests/hover_test.odin44
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index cbb7ba9..9cc1d5b 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -491,7 +491,7 @@ ast_hover_foreign_package_name_collision :: proc(t: ^testing.T) {
packages = packages[:],
}
- test.expect_hover(t, &source, "node.bar: struct {\n}")
+ test.expect_hover(t, &source, "node.bar: ^my_package.bar :: struct {}")
}
@(test)
ast_hover_struct :: proc(t: ^testing.T) {
@@ -638,6 +638,26 @@ ast_hover_struct_field_definition :: proc(t: ^testing.T) {
}
@(test)
+ast_hover_struct_field_complex_definition :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Bar :: struct {}
+
+ Foo :: struct {
+ b{*}ar: ^Bar,
+ f: proc(a: int) -> int,
+ }
+
+ foo := Foo{
+ bar = 1
+ }
+ `,
+ }
+
+ test.expect_hover(t, &source, "Foo.bar: ^test.Bar :: struct {}")
+}
+
+@(test)
ast_hover_within_struct_declaration :: proc(t: ^testing.T) {
source := test.Source {
main = `package test
@@ -853,6 +873,28 @@ ast_hover_sub_string_slices :: proc(t: ^testing.T) {
test.expect_hover(t, &source, "test.sub_str: string")
}
+
+@(test)
+ast_hover_struct_field_use :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct {
+ value: int,
+ }
+
+ Bar :: struct {
+ foo: Foo,
+ }
+
+ main :: proc() {
+ bar := Bar{}
+ bar.fo{*}o.value += 1
+ }
+ `,
+ }
+
+ test.expect_hover(t, &source, "Bar.foo: test.Foo :: struct {\n\tvalue: int,\n}")
+}
/*
Waiting for odin fix