Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make updating event configurable #62

Open
xzbdmw opened this issue Mar 17, 2024 · 1 comment
Open

Make updating event configurable #62

xzbdmw opened this issue Mar 17, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@xzbdmw
Copy link

xzbdmw commented Mar 17, 2024

If I loop a table in render function, each time debounce time hit, render function will rerun, which is a waste of cpu, and I'd like to make render function only run when I enter nomal mode, is it possible?
For example, I'd like to only show the severiest diagnostic, so I'm looping a table, as soon as I found one, break the loop. But the debounce time makes the behaviour unable to determine, because maybe when it loops to info, gets a n>0, breaks the loop, so that possible error is ignored

                                local function get_diagnostic_label()
                    local icons = {
                        Error = "",
                        Warn = "",
                        Info = "",
                        Hint = "",
                    }

                    local label = {}
                    for severity, _ in pairs(icons) do
                        local n = #vim.diagnostic.get(
                            props.buf,
                            { severity = vim.diagnostic.severity[string.upper(severity)] }
                        )
                        if n > 0 then
                            label = {
                                { "" }, -- 前缀图标
                                {
                                    n,
                                    group = "DiagnosticSign" .. severity,
                                },
                            }
                            break
                        end
                    end
                    return label
                end
@b0o b0o added enhancement New feature or request help wanted Extra attention is needed labels Mar 17, 2024
@xzbdmw xzbdmw closed this as completed Mar 27, 2024
@b0o
Copy link
Owner

b0o commented Mar 27, 2024

Thanks for your request. I plan on adding this in the future. Let's keep this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants