Open frobbs opened 1 year ago
I got this when I run gg=G
on your code
void foo()
{
{
}
}
#ifndef MyDef
void bar()
{
{
}
}
#endif
Which doesn't seem to be wrong(aside from one extra indentation)
Thank you for taking a look at this.
As i wrote, I only get the behavior while typing, as you see in the video. This mechanism is triggered by treesitter, isn't it? If I trigger the indentation manually at the end of the video, the code is indented correctly.
I use autoclose plugin for curly braces but it doesn't affect the indentation. I'm not quite sure why you get those extra indentation.
I think it's just being over dedented. I'll try to figure out why that's the case
The tree errors out, which is weird. This is kindof... expected? Considering that {
triggers indentkeys, and when that exists, it's inside an ERROR node, and no longer inside a function definition node (because it's now the ERROR node), leading to one less indent
I'll try to see if it's possible to one-off this case
Describe the bug
Hi,
if I type down the following code, the code inside the preprocessor block is not properly indented while typing.
Same behavior for if, loops and methods. If i mark the block inside "bar" and trigger the indentation, the block is indented properly, I only see the effect while typing.
I tried to break it further down and changed the indents.scm for c to the following:
The effect still occurs and I don't see any queries triggering for the "preproc_ifdef" node.
Tree for the example:
This is quite painful in c++ working in header files because of the include guard
To Reproduce
create a .c file
write a function inside a ifndef
write a if/ loop or block
Expected behavior
No response
Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
No response