From ea3a37a9758d873feec3feac37a358e4225a5871 Mon Sep 17 00:00:00 2001 From: ganhaque Date: Wed, 6 Nov 2024 12:09:14 -0600 Subject: [PATCH] fix(wgsl): indent call expression params (#7309) --- queries/wgsl/indents.scm | 1 + ...nstructor_or_function_call_expression.wgsl | 11 ++++++++++ tests/indent/wgsl_spec.lua | 20 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 tests/indent/wgsl/type_constructor_or_function_call_expression.wgsl diff --git a/queries/wgsl/indents.scm b/queries/wgsl/indents.scm index a866bd62f..579c665bc 100644 --- a/queries/wgsl/indents.scm +++ b/queries/wgsl/indents.scm @@ -2,6 +2,7 @@ (compound_statement) (loop_statement) (struct_declaration) + (type_constructor_or_function_call_expression) ] @indent.begin ((parameter_list) @indent.begin diff --git a/tests/indent/wgsl/type_constructor_or_function_call_expression.wgsl b/tests/indent/wgsl/type_constructor_or_function_call_expression.wgsl new file mode 100644 index 000000000..dff667e77 --- /dev/null +++ b/tests/indent/wgsl/type_constructor_or_function_call_expression.wgsl @@ -0,0 +1,11 @@ +fn f() { + let a = foo( + b, + c, + ); + + let a = Foo( + b, + c, + ); +} diff --git a/tests/indent/wgsl_spec.lua b/tests/indent/wgsl_spec.lua index e70215a7b..e1bf618f8 100644 --- a/tests/indent/wgsl_spec.lua +++ b/tests/indent/wgsl_spec.lua @@ -20,5 +20,25 @@ describe("indent WGSL:", function() run:new_line("basic.wgsl", { on_line = 52, text = "c: u32,", indent = 2 }) run:new_line("basic.wgsl", { on_line = 56, text = "c: u32,", indent = 2 }) run:new_line("basic.wgsl", { on_line = 59, text = "c: u32,", indent = 2 }) + run:new_line("type_constructor_or_function_call_expression.wgsl", { + on_line = 3, + text = "b", + indent = 4, + }) + run:new_line("type_constructor_or_function_call_expression.wgsl", { + on_line = 4, + text = "c", + indent = 4, + }) + run:new_line("type_constructor_or_function_call_expression.wgsl", { + on_line = 8, + text = "b", + indent = 4, + }) + run:new_line("type_constructor_or_function_call_expression.wgsl", { + on_line = 9, + text = "c", + indent = 4, + }) end) end)