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

Hidden text for elaborate if-statements in Python #75

Closed serhez closed 8 months ago

serhez commented 8 months ago

Describe the bug The first character of some lines is hidden by the indent lines. In the screenshot, you can see that the closing parenthesis of the if statement is hidden, as well as the first character of and and len.

To Reproduce Replicate the code in the screenshot. I have the following 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 expect the indent lines to never cover real text.

Screenshots Screenshot 2023-11-14 at 17 08 38

serhez commented 8 months ago

Given that there seem to be a lot of cases where real text is hidden by virtual text (the indent lines), is it possible to tackle this problem at the root by having some sort of check that the cell where the indent line virtual text will be placed is empty (i.e., it's a space, tab, newline, etc.)? I'm not sure how this plugin is implemented, but it seems very tedious to attempt to solve these problems one by one.

serhez commented 8 months ago

I would also like to say that these types of problems (hiding real text) are not rare at all. I love this plugin (thanks <3) but it's hardly usable because very often I can't see the first character of my code.

shellRaining commented 8 months ago

I'm sorry for the late reply because I have been busy with some other things recently. At the same time, I also feel that maintaining version 1.0.0 has become very difficult, so I am trying to make some big refactoring. I will also try to fix the issues you mentioned in the latest version. thanks~

serhez commented 8 months ago

Don't be sorry, thanks for making the plugin open source! Is there a branch for developing the new version?

shellRaining commented 8 months ago

yes, but i haven't push the branch