mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
indents(php): align with C indentation
Fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/2357
This commit is contained in:
parent
77d247b300
commit
ae4c982f94
3 changed files with 34 additions and 3 deletions
|
|
@ -10,14 +10,13 @@
|
|||
] @indent
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @ignore
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
|
|
|
|||
12
tests/indent/php/example.php
Normal file
12
tests/indent/php/example.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
class example
|
||||
{
|
||||
public int $variable;
|
||||
// indentation works correctly here
|
||||
|
||||
public function foo()
|
||||
{
|
||||
// indentation works correctly here
|
||||
}
|
||||
}
|
||||
20
tests/indent/php_spec.lua
Normal file
20
tests/indent/php_spec.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
local Runner = require("tests.indent.common").Runner
|
||||
|
||||
local run = Runner:new(it, "tests/indent/php", {
|
||||
tabstop = 4,
|
||||
shiftwidth = 4,
|
||||
softtabstop = 0,
|
||||
expandtab = true,
|
||||
})
|
||||
|
||||
describe("indent PHP:", function()
|
||||
describe("whole file:", function()
|
||||
run:whole_file(".", {
|
||||
expected_failures = {},
|
||||
})
|
||||
end)
|
||||
|
||||
describe("new line:", function()
|
||||
run:new_line("example.php", { on_line = 11, text = "// new line starts 1 indentation to far", indent = 4 })
|
||||
end)
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue