From 93401ea027155fd72ec7850bd0ed74ab9e2b8b07 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Fri, 19 Sep 2025 08:50:13 -0400 Subject: Improve hover information for constant proc lits --- tests/completions_test.odin | 4 ++-- tests/hover_test.odin | 44 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 13196a3..a97ff0f 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -4681,7 +4681,7 @@ ast_completion_struct_field_name :: proc(t: ^testing.T) { } `, } - test.expect_completion_docs(t, &source, "", {}, {"test.Foo :: struct {}"}) + test.expect_completion_docs(t, &source, "", {}, {"test.Foo :: struct{}"}) } @(test) @@ -4696,7 +4696,7 @@ ast_completion_struct_field_value :: proc(t: ^testing.T) { } `, } - test.expect_completion_docs(t, &source, "", {"test.Foo :: struct {}"}) + test.expect_completion_docs(t, &source, "", {"test.Foo :: struct{}"}) } @(test) diff --git a/tests/hover_test.odin b/tests/hover_test.odin index ee43c50..9f41c2c 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -237,7 +237,7 @@ ast_hover_on_array_infer_length_variable :: proc(t: ^testing.T) { `, } - test.expect_hover(t, &source, "test.vec :: [?]f32") + test.expect_hover(t, &source, "test.vec :: [?]f32 {\n\t1,\n\t2,\n\t3,\n}") } @(test) @@ -3192,7 +3192,7 @@ ast_hover_documentation_reexported :: proc(t: ^testing.T) { `, packages = packages[:], } - test.expect_hover(t, &source, "my_package.Foo :: struct {}\n Documentation for Foo") + test.expect_hover(t, &source, "my_package.Foo :: struct{}\n Documentation for Foo") } @(test) @@ -3218,7 +3218,7 @@ ast_hover_override_documentation_reexported :: proc(t: ^testing.T) { `, packages = packages[:], } - test.expect_hover(t, &source, "my_package.Foo :: struct {}\n New docs for Foo") + test.expect_hover(t, &source, "my_package.Foo :: struct{}\n New docs for Foo") } @(test) @@ -3913,7 +3913,7 @@ ast_hover_map_empty_struct_literal :: proc(t: ^testing.T) { m{*}: map[int]struct{} `, } - test.expect_hover(t, &source, "test.m: map[int]struct {}") + test.expect_hover(t, &source, "test.m: map[int]struct{}") } @(test) @@ -4878,6 +4878,42 @@ ast_hover_const_untyped_value :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.FOO :: 123") } + +@(test) +ast_hover_const_comp_lit :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + a: int, + b: string, + } + + F{*}OO :: Foo { + a = 1, + b = "b", + } + `, + } + test.expect_hover(t, &source, "test.FOO :: Foo {\n\ta = 1,\n\tb = \"b\",\n}") +} + +@(test) +ast_hover_const_comp_lit_with_type :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + a: int, + b: string, + } + + F{*}OO : Foo : { + a = 1, + b = "b", + } + `, + } + test.expect_hover(t, &source, "test.FOO : Foo : {\n\ta = 1,\n\tb = \"b\",\n}") +} /* Waiting for odin fix -- cgit v1.2.3