lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.14k stars 102 forks source link

Adds wrong indentline in nested functions #891

Closed MystikReasons closed 4 months ago

MystikReasons commented 4 months ago

Problem

The bug shows itself in functions that are relatively big (more than 100 lines) and if it has many nestings. In the middle of scrolling it adds a new indentline which absolutely does not make sense. I've tested the same file in VSCode and there it is working as expected.

Steps to reproduce

Please find attached my test file (I needed to zip it since I can't upload .php files). It just contains a function which is around 120 lines long and has many nestings (5 nestings maximum) test.zip

Expected behavior

This is how it should look like (before line 88): grafik

This is how it looks after line 88: grafik

Neovim version (nvim -v)

0.10.0

Can someone reproduce this issue?

lukas-reineke commented 4 months ago

Your shiftwidth is not set correctly. Take a look here for a more detailed explanation.

MystikReasons commented 4 months ago

Hi @lukas-reineke Thank you for the quick reply. I also noticed the same behaviour in Lazyvim (indent-blankline ist the default app). Does that mean it is also configured wrong there?

Edit: Nevermind, Lazyvim can't do anything about that. It's default value is set to 2 and every file with not 2 shifts will therefore be wrongly read.

lukas-reineke commented 4 months ago

Yeah, out of the box, you can only set it to one value. There are plugins that set it automatically per buffer, like https://github.com/tpope/vim-sleuth