diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-07 20:29:30 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-07 20:53:27 -0400 |
| commit | 8ec7acff2b5a4a628d09ad3fe4f4b8f74fb8d856 (patch) | |
| tree | 7cb50ad364e5ca369e135d40ac054398888b2de8 /tests | |
| parent | 41c5c76526aad8ca69525abfed045d501171fe24 (diff) | |
Fix hover on external package structs returned from procedures
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hover_test.odin | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 840538f..3f941b1 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -83,7 +83,37 @@ ast_hover_external_package_parameter :: proc(t: ^testing.T) { packages = packages[:], } - test.expect_hover(t, &source, "test.cool: My_Struct") + test.expect_hover(t, &source, "test.cool: my_package.My_Struct :: struct {\n\tone: int,\n\ttwo: int,\n\tthree: int,\n}") +} + +@(test) +ast_hover_external_package_parameter_pointer :: proc(t: ^testing.T) { + packages := make([dynamic]test.Package, context.temp_allocator) + + append( + &packages, + test.Package { + pkg = "my_package", + source = `package my_package + My_Struct :: struct { + one: int, + two: int, + three: int, + } + `, + }, + ) + source := test.Source { + main = `package test + import "my_package" + main :: proc(cool: ^my_package.My_Struct) { + cool{*} + } + `, + packages = packages[:], + } + + test.expect_hover(t, &source, "test.cool: ^my_package.My_Struct :: struct {\n\tone: int,\n\ttwo: int,\n\tthree: int,\n}") } @(test) @@ -429,6 +459,36 @@ ast_hover_struct :: proc(t: ^testing.T) { } @(test) +ast_hover_proc_param_with_struct_from_another_package :: proc(t: ^testing.T) { + packages := make([dynamic]test.Package, context.temp_allocator) + + append( + &packages, + test.Package { + pkg = "my_package", + source = `package my_package + My_Struct :: struct { + one: int, + two: int, + three: int, + } + `, + }, + ) + source := test.Source { + main = `package test + import "my_package" + main :: proc(cool: my_package.My{*}_Struct) { + cool + } + `, + packages = packages[:], + } + + test.expect_hover(t, &source, "test.cool: My_Struct :: struct {\n\tone: int,\n\ttwo: int,\n\tthree: int\n}") +} + +@(test) ast_hover_struct_variable :: proc(t: ^testing.T) { source := test.Source { main = `package test |