mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
fix(wgsl): indent first parameter of function definition
This commit is contained in:
parent
7dc8aabe86
commit
0d3426a2e8
3 changed files with 37 additions and 2 deletions
|
|
@ -1,10 +1,23 @@
|
|||
[
|
||||
(parameter_list)
|
||||
(compound_statement)
|
||||
(loop_statement)
|
||||
(struct_declaration)
|
||||
] @indent.begin
|
||||
|
||||
((parameter_list) @indent.begin
|
||||
(#set! indent.immediate)
|
||||
(#set! indent.start_at_same_line))
|
||||
|
||||
(function_declaration
|
||||
"(" @indent.begin
|
||||
(#set! indent.immediate))
|
||||
|
||||
(ERROR
|
||||
"fn"
|
||||
(identifier)
|
||||
"(" @indent.begin
|
||||
(#set! indent.immediate))
|
||||
|
||||
(compound_statement
|
||||
"}" @indent.end)
|
||||
|
||||
|
|
|
|||
|
|
@ -41,3 +41,20 @@ fn vertex(vertex: Vertex,
|
|||
out.b = 2;
|
||||
return out;
|
||||
}
|
||||
|
||||
fn foo(
|
||||
a: u32,
|
||||
b: u32,
|
||||
) {
|
||||
return a;
|
||||
}
|
||||
|
||||
fn bar(
|
||||
) {}
|
||||
|
||||
fn baz(
|
||||
a: u32,
|
||||
) {}
|
||||
|
||||
fn qux(
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,5 +15,10 @@ describe("indent WGSL:", function()
|
|||
})
|
||||
end)
|
||||
|
||||
describe("new line:", function() end)
|
||||
describe("new line:", function()
|
||||
run:new_line("basic.wgsl", { on_line = 47, text = "c: u32,", indent = 2 })
|
||||
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 })
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue