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
654 stars 33 forks source link

Indent lines are not shown in Python docstrings #77

Closed serhez closed 5 months ago

serhez commented 12 months ago

Describe the bug Indent lines are not shown in Python docstrings, as shown in the screenshot below.

To Reproduce You can try the code in the screenshot. My config:

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,
    },
    style = {
        {
            fg = c.info_fg,
        },
    },
    exclude_filetypes = {
        qf = true,
        help = true,
        dapui_scopes = true,
        dapui_watches = true,
        dapui_stacks = true,
        dapui_breakpoints = true,
        dapui_console = true,
        ["dap-repl"] = true,
        harpoon = true,
        dropbar_menu = true,
        glow = true,
        aerial = true,
        dashboard = true,
        lspinfo = true,
        lspsagafinder = true,
        packer = true,
        checkhealth = true,
        man = true,
        mason = true,
        NvimTree = true,
        ["neo-tree"] = true,
        plugin = true,
        lazy = true,
        TelescopePrompt = true,
        [""] = true, -- because TelescopePrompt will set a empty ft, so add this.
        alpha = true,
        toggleterm = true,
        sagafinder = true,
        sagaoutline = true,
        better_term = true,
        fugitiveblame = true,
        Trouble = true,
        Outline = true,
        starter = true,
        NeogitPopup = true,
        NeogitStatus = true,
        DiffviewFiles = true,
        DiffviewFileHistory = true,
        DressingInput = true,
        spectre_panel = true,
        zsh = true,
        vuffers = true,
    },
},

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

line_num = {
    enable = false,
},

blank = {
    enable = false,
    chars = {
        " ",
    },
    style = {
        {
            bg = c.bg,
        },
        {
            bg = c.cursor_line_bg,
        },
    },
},

Expected behavior I would expect the indent lines to be shown for the docstrings.

Screenshots Screenshot 2023-11-14 at 17 07 54

shellRaining commented 12 months ago

This problem is still related to the treesitter option. Treesitter seems to determine that the docstring indentation of Python is 0 by default. To solve it, a lot of special judgments must be added, so it will not be fixed in the near future.

serhez commented 12 months ago

It seems that the best option for now is to disable the treesitter option then, thanks!

shellRaining commented 12 months ago

In fact, except for this issue, I have fixed the previous two. If you can tolerate such a little bit of unsightliness, this option is still very nice~

I will push the patch to main brach later

serhez commented 12 months ago

In fact, except for this issue, I have fixed the previous two. If you can tolerate such a little bit of unsightliness, this option is still very nice~

I will push the patch to main brach later

What would you say are the advantages of the treesitter option? I've been using the plugin today with treesitter = false and I haven't noticed anything much different, besides the indent lines not occluding real text.

shellRaining commented 12 months ago

if use treesitter, the last line show like this

image

else

image

Using treesitter can reduce such visual interference, but I have plans to improve the display of the latter in the future.

serhez commented 12 months ago

That makes sense, thanks for the example! ❤️

shellRaining commented 5 months ago

fixed in dev branch, welcome to experience

serhez commented 5 months ago

Thanks!