shellRaining / hlchunk.nvim

This is the lua implementation of nvim-hlchunk, you can use this neovim plugin to highlight your indent line and the current chunk (context) your cursor stayed
MIT License
472 stars 29 forks source link

Chunk guides hidden behind indent guides #107

Closed serhez closed 1 month ago

serhez commented 1 month ago

Describe the bug The chunk guides are most of the time partially hidden behind the indent guides (see video attached).

To Reproduce Scroll up and down in code with nested indentation. My config is below; you may need to replace the references to my color and icons helpers. I've also tried setting chunk.use_treesitter = false but it doesn't help.

require("hlchunk").setup({
    chunk = {
        enable = true,
        use_treesitter = true,
        notify = true,
        chars = {
            horizontal_line = icons.bar.horizontal_thin,
            vertical_line = icons.bar.vertical_center_thin,
            left_top = icons.bar.upper_left_corner_thin,
            left_bottom = icons.bar.lower_left_corner_thin,
            right_arrow = icons.bar.horizontal_thin,
        },
        textobject = "ic",
        style = {
            {
                fg = c.info_fg, -- no error
            },
            {
                fg = c.error_fg, -- error
            },
        },
        -- FIX: The animation creates artifacts when moving the cursor fast
        -- duration = 150,
        -- delay = 1,
        duration = 0,
        delay = 0,
    },

    indent = {
        enable = true,
        use_treesitter = false,
        chars = {
            icons.bar.vertical_center_thin,
        },
        style = {
            {
                fg = c.comment_fg,
            },
        },
        delay = 0,
    },

    line_num = {
        enable = false,
    },

    blank = {
        enable = false,
    },
})

Expected behavior The chunk guides should have preference over indent guides.

Screenshots

https://github.com/shellRaining/hlchunk.nvim/assets/18057093/65b1c3a3-abfc-41e1-aee2-dac895c46b79

shellRaining commented 1 month ago

Sorry, the previous issue was not explained clearly. The indent mod does not need to set the use_treesitter option to true, but chunk still relies more on treesitter (because they work differently). I will mention this in next version

as for the bug, I can't reproduce it. are you using the latest commit on the main branch?

And you can try to set priority field to a large number, maybe this can solve, default priority is 15

https://github.com/shellRaining/hlchunk.nvim/assets/111564053/cf3b0c9e-47f5-495c-9056-75ddc3c77f26

serhez commented 1 month ago

@shellRaining Thanks for the explanation! I tried setting a higher priority for the chunk mod, but this doesn't solve the issue. Could you try reproducing with my config or sharing yours? It's strange that we wouldn't get the same behavior.

shellRaining commented 1 month ago

I'll take a look at your dotfile, by the way, your color scheme looks great!

shellRaining commented 1 month ago

I found the reason, it is because your configuration file using tabs instead of spaces, and I did not handle the relevant parts correctly.

And I also found that you have list a long exclude_filetypes table, which now can just list what you need, it will appended to the exclude_filetypes I have collected automatically~

serhez commented 1 month ago

@shellRaining Ok perfect! ❤️