diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-12 13:34:12 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-12 13:34:12 -0400 |
| commit | 82c8a0b2cb1373afeb9f87339cc3aaccdffb31ff (patch) | |
| tree | 156ef3abf4ab47c82e154e20b7c5bc19ba3df0e6 /tests/hover_test.odin | |
| parent | 3499fc72369763f6b20e39844a274c32e05f9d80 (diff) | |
Add comments when hovering basic struct fields and no longer show the underlying type
Diffstat (limited to 'tests/hover_test.odin')
| -rw-r--r-- | tests/hover_test.odin | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 2a0059d..0c9aa76 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -511,7 +511,7 @@ ast_hover_foreign_package_name_collision :: proc(t: ^testing.T) { packages = packages[:], } - test.expect_hover(t, &source, "node.bar: ^my_package.bar :: struct {}") + test.expect_hover(t, &source, "node.bar: ^my_package.bar") } @(test) ast_hover_struct :: proc(t: ^testing.T) { @@ -680,7 +680,7 @@ ast_hover_struct_field_complex_definition :: proc(t: ^testing.T) { `, } - test.expect_hover(t, &source, "Foo.bar: ^test.Bar // inline docs") + test.expect_hover(t, &source, "Foo.bar: ^test.Bar // inline docs\n Docs") } @(test) @@ -971,7 +971,7 @@ ast_hover_distinguish_names_correctly_variable_assignment :: proc(t: ^testing.T) `, } - test.expect_hover(t, &source, "Foo.bar: ^test.Bar :: struct {\n\tbar: int,\n}") + test.expect_hover(t, &source, "Foo.bar: ^test.Bar") } @(test) @@ -1007,7 +1007,7 @@ ast_hover_struct_field_use :: proc(t: ^testing.T) { `, } - test.expect_hover(t, &source, "Bar.foo: test.Foo :: struct {\n\tvalue: int,\n}") + test.expect_hover(t, &source, "Bar.foo: test.Foo") } @(test) @@ -2327,6 +2327,60 @@ ast_hover_overload_proc_strings_from_different_packages :: proc(t: ^testing.T) { "my_package.foo: proc(a: string, b: int)", ) } + +@(test) +ast_hover_struct_field_should_show_docs_and_comments :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct { + // a docs + a: int, // a comment + } + + main :: proc() { + foo := Foo{} + foo.a{*} + } + `, + } + test.expect_hover( t, &source, "Foo.a: int // a comment\n a docs") +} + +@(test) +ast_hover_struct_field_should_show_docs_and_comments_on_field :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct { + // a docs + a{*}: int, // a comment + } + `, + } + test.expect_hover( t, &source, "Foo.a: int // a comment\n a docs") +} + +@(test) +ast_hover_struct_field_should_show_docs_and_comments_on_struct_types :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct { + // bar docs + bar: Bar, // bar comment + } + + Bar :: struct {} + + main :: proc() { + foo := Foo{} + foo.bar{*} + } + `, + } + test.expect_hover( t, &source, "Foo.bar: test.Bar // bar comment\n bar docs") +} /* Waiting for odin fix |