mei28 / luminate.nvim

🌟 Highlight yanked, pasted, and undone/redone text in Neovim with a splash of color.
MIT License
39 stars 2 forks source link

Exclusions for certain type of buffers #17

Open JayLCypher opened 3 months ago

JayLCypher commented 3 months ago

Related to commit fc1c8211b066fc44ec99cbd06f059967722bec97

With the removal of the HIGHLIGHT_THRESHOLD, it seems that entire buffers dedicated certain plugins that update often (such as Lazy, Mason, Neotree, etc.) become highlighted on update.

Suggest exclusion support for (popular at least) plugin buffers. I know some other plugins do similar things. If you need examples or a video of the issue, lmk.

mei28 commented 3 months ago

I removed the highlight threshold to improve my plugin, but I didn't anticipate the cons 😢 .

Do you think it would be useful for users to restore the highlight threshold or add the exclude file type option (or both)?

Additionally, I can't understand your issue about "it seems that entire buffers dedicated to certain plugins that update often (such as Lazy, Mason, Neotree, etc.) become highlighted on update." Could you please provide a video to reproduce this issue?

Thank you!

JayLCypher commented 3 months ago

https://github.com/user-attachments/assets/bca561dd-0d17-44dd-b2f7-9cc19340002e

This should suffice. As you can see, the highlighting pops up on every update from NeoTree, Lazy and Mason (and I assume other that use similar mechanism to display UI).

Tested on Linux Native in foot + Neovide and happens on my WSL setup too. Removing the plugin removes all the highlighting on update.

I'm not sure how you're setting up the callback for the highlighting, but I suspect it's should maybe not react to button presses but instead listen for nvim events (such as pasting).

mei28 commented 3 months ago

Thank you for your video. I tried to reproduce your issue following the steps in the video, but in my environment, the highlighting did not occur as expected.

Could you please provide the minimal settings to help me troubleshoot this?

https://github.com/user-attachments/assets/c510cd7b-9b7f-4c2e-bfc7-2dc161683e5e

mei28 commented 3 months ago

It seems that the highlight is indeed coming from my plugin, so there might be an issue with it. Previously, I implemented the callback for TextChanged, but in the current implementation, the callback is triggered by Paste.

JayLCypher commented 3 months ago

Tested on my lappy tappy with a pretty blank profile. Basically loading Lazy with the plugin load code from Kickstart.nvim + illuminate.nvim. Still get the highlighting.

Minimal init.lua ```lua local illuminate = { "mei28/luminate.nvim", event = "VeryLazy", opts = { } } local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" local out = vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", -- latest stable release lazyrepo, lazypath, } if vim.v.shell_error ~= 0 then vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { out, "WarningMsg" }, { "\nPress any key to exit..." }, }, true, {}) vim.fn.getchar() os.exit(1) end end vim.opt.rtp:prepend(lazypath) -- Lazy plugin spec: https://github.com/folke/lazy.nvim#-plugin-spec local lazy = require("lazy") lazy.setup({ illuminate, }, {}) ```

I doubt it's something external to the plugin, I checked by simply setting "enabled = false" in the config and that immediately fixed it.

mei28 commented 3 months ago

Thank you for your minimal settings. I found that in the later case, the plugin was lazy-loaded, so the incorrect highlight didn't occur. When I loaded the plugin properly, I found the same issue!

I will think about how to fix it. If you have any suggestions or can provide a PR, that would be greatly appreciated.

mei28 commented 3 months ago

the flickering highlight to be annoying, so I have temporarily reverted the changes.