mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 11:36:54 -04:00
Indent is not handled correctly when adding new lines.
It seems that functions/loops/etc. are not recognized until they have at
least one indented block.
For example, if you enter a newline after `func foo():`, the cursor will
not be indented. If you manually indent and add a line like `pass`,
e.g.:
```
func foo():
pass
```
now any insertions above or below `pass` will be indented correctly.
This might be an issue with the grammar, as it seems to apply to highlights
as well.
The following will not be highligted
```
func foo():
```
However, the following will be:
```
func foo():
pass
```
20 lines
471 B
Lua
20 lines
471 B
Lua
local Runner = require("tests.indent.common").Runner
|
|
|
|
local run = Runner:new(it, "tests/indent/gdscript", {
|
|
tabstop = 4,
|
|
shiftwidth = 4,
|
|
softtabstop = 0,
|
|
expandtab = false,
|
|
})
|
|
|
|
describe("indent GDScript:", function()
|
|
describe("whole file:", function()
|
|
run:whole_file(".", {
|
|
expected_failures = {},
|
|
})
|
|
end)
|
|
|
|
describe("new line:", function()
|
|
run:new_line("basic_blocks.gd", { on_line = 1, text = "var member := 0", indent = 0 })
|
|
end)
|
|
end)
|