Indent lost in big json file #861
-
I have a big json file, with 3 spaces indent. At the start it looks fine: After some lines however, I get this: It seems to depend on the fact I have Edit: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This is expected behavior. You can change how big this buffer is with |
Beta Was this translation helpful? Give feedback.
-
I have the same issue, I use nvim-treesitter for indentation, I have not defined any shiftwidth myself. Is the issue coming from treesitter? EDIT: Added this config, but I think it is very weird that ibl has to deal with this, indentation level should come from treesitter. require("ibl").setup{
viewport_buffer = {
min = 150,
},
} |
Beta Was this translation helpful? Give feedback.
This is expected behavior.
IBL uses both your settings, like
shfitwidth
, as well as the surrounding code, to determine indentations.But looking at the surrounding code from the beginning of the file would be very slow, so by default it only looks at 30 lines above the first displayed line.
So if the start of the indentation is further up than that, it uses
shiftwidth
instead.You can change how big this buffer is with
:help ibl.config.viewport_buffer.min
, but the correct solution is to just setshiftwidth
.