RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.12k stars 44 forks source link

On opening/scrolling some binary files: "vim-illuminate: An internal error has occured: false"Vim:E976: using Blob as a String" #186

Open andis-sprinkis opened 7 months ago

andis-sprinkis commented 7 months ago

Describe the bug A clear and concise description of what the bug is.

An error message occurs on opening and scrolling through some binary files.

To Reproduce Steps to reproduce the behavior (include minimal init.vim or .vimrc):

  1. nvim test.txt test.txt (this is a chunk of a WAV file from Wikipedia)
  2. See error
    vim-illuminate: An internal error has occured: false"Vim:E976: using Blob as a String"

Config. - just vim-illuminate installed with lazy.nvim.

Note Omitting a minimal init.vim/init.lua/.vimrc will likely result in the issue being closed without explanation.

Output from :IlluminateDebug

buf_should_illuminate 1 true
config {
  case_insensitive_regex = false,
  delay = 100,
  filetype_overrides = {},
  filetypes_allowlist = {},
  filetypes_denylist = { "dirbuf", "dirvish", "fugitive" },
  min_count_to_highlight = 1,
  modes_allowlist = {},
  modes_denylist = {},
  providers = { "lsp", "treesitter", "regex" },
  providers_regex_syntax_allowlist = {},
  providers_regex_syntax_denylist = {},
  under_cursor = true
}
started false
provider table: 0x7ff0e85b7590 regex
`termguicolors` false

Expected behavior A clear and concise description of what you expected to happen.

Screenshots 1700416619

Additional context Add any other context about the problem here.

RRethy commented 6 months ago

Not sure how to fix this, I'll leave it open in case someone has any ideas. The error seems to be a result of string.format returning a blob which we then pass to vim.escape which is no bueno, but I'm not sure how to convert it to a string and I don't understand why string.format is even returning a blob. Looking at the Neovim source code would probably clear things up but I'm probably not going to spend a significant amount of time fixing this due to how rare it is.