From 384aaa75affae6fdceca2811ddd9a0b57d842e2d Mon Sep 17 00:00:00 2001 From: Damian Tarnawski Date: Fri, 4 Jul 2025 21:08:19 +0200 Subject: Support inlay hints with named params --- tests/inlay_hints_test.odin | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/inlay_hints_test.odin b/tests/inlay_hints_test.odin index 45cef31..06cae51 100644 --- a/tests/inlay_hints_test.odin +++ b/tests/inlay_hints_test.odin @@ -6,7 +6,7 @@ import "core:testing" import test "src:testing" @(test) -ast_inlay_hints_default_parameters :: proc(t: ^testing.T) { +ast_inlay_hints_default_params :: proc(t: ^testing.T) { source := test.Source { main = `package test @@ -34,7 +34,7 @@ ast_inlay_hints_default_parameters :: proc(t: ^testing.T) { } @(test) -ast_inlay_hints_default_parameters_after_required :: proc(t: ^testing.T) { +ast_inlay_hints_default_params_after_required :: proc(t: ^testing.T) { source := test.Source { main = `package test @@ -62,7 +62,36 @@ ast_inlay_hints_default_parameters_after_required :: proc(t: ^testing.T) { } @(test) -ast_inlay_hints_parameters :: proc(t: ^testing.T) { +ast_inlay_hints_default_params_after_named :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + my_function :: proc(a: int, b := false, c := 42) {} + + main :: proc() { + my_function(a=1) + } + `, + packages = {}, + config = { + enable_inlay_hints_params = true, + enable_inlay_hints_default_params = true, + }, + } + + test.expect_inlay_hints(t, &source, {{ + position = {5, 18}, + kind = .Parameter, + label = ", b = false", + }, { + position = {5, 18}, + kind = .Parameter, + label = ", c = 42", + }}) +} + +@(test) +ast_inlay_hints_params :: proc(t: ^testing.T) { source := test.Source { main = `package test @@ -90,7 +119,7 @@ ast_inlay_hints_parameters :: proc(t: ^testing.T) { } @(test) -ast_inlay_hints_mixed_parameters :: proc(t: ^testing.T) { +ast_inlay_hints_mixed_params :: proc(t: ^testing.T) { source := test.Source { main = `package test @@ -173,7 +202,7 @@ ast_inlay_hints_no_hints_same_name :: proc(t: ^testing.T) { } @(test) -ast_inlay_hints_variadic_parameters :: proc(t: ^testing.T) { +ast_inlay_hints_variadic_params :: proc(t: ^testing.T) { source := test.Source { main = `package test -- cgit v1.2.3