indent-blankline.nvim icon indicating copy to clipboard operation
indent-blankline.nvim copied to clipboard

Support irregular indentation

Open lukas-reineke opened this issue 3 years ago • 6 comments

When using indent guides for Haskell code -- see the image.

image

The only non-default settings here are g:indent_blankline_char, g:indent_blankline_buftype_exclude and g:indent_blankline_show_trailing_blankline_indent = v:false.

I believe this happens because this plugin simply places an indentation guide every &shiftwidth columns. But, as the image shows, this is not enough for typical Haskell indentation, since it can start at basically any column.

Perhaps we could look into placing the indent guide on the first non-whitespace column above? Or maybe somehow use tree-sitter to try to solve this? (note: using g:indent_blankline_use_treesitter = 1 didn't solve this, as I understand all it does is highlight the current indentation level).

Originally posted by @dccsillag in https://github.com/lukas-reineke/indent-blankline.nvim/issues/153#issuecomment-893943554

lukas-reineke avatar Aug 06 '21 02:08 lukas-reineke

I made this a new issue.

It's an interesting problem. I believe it could be solvable, but it's not easy.

lukas-reineke avatar Aug 06 '21 02:08 lukas-reineke

Maybe it's worth documenting another instance of this problem (again exemplified in Haskell code): multiple indent guides where there should only be one.

image

dccsillag avatar Aug 06 '21 02:08 dccsillag

do you have examples from other editors how it should look like?

lukas-reineke avatar Aug 06 '21 02:08 lukas-reineke

I have an idea in my head on how it should look like, but I feel like I've also seen some editor out there do it properly. I'll look for it.

dccsillag avatar Aug 06 '21 03:08 dccsillag

Update: Just found https://github.com/DarthFennec/highlight-indent-guides, which implements this stuff in Emacs, and looks correct (for Lisp code, which suffers from the same issues as Haskell).

dccsillag avatar Aug 06 '21 03:08 dccsillag

Obviously, show current context indent works well, could fully use treesitter implement all feature of this plugin?

ofseed avatar Aug 29 '21 18:08 ofseed

Are there any plans to implement this feature?

alexmozaidze avatar Jun 19 '23 12:06 alexmozaidze

It is on the list of things I want to do in the next version. But I have much less time these days, I don't know when I'll work on it.

lukas-reineke avatar Jun 20 '23 01:06 lukas-reineke

Supported in version 3

lukas-reineke avatar Sep 28 '23 06:09 lukas-reineke