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
vim-illuminate: An internal error has occured: false"...packer/start/vim-illuminate/lua/illuminate/highlight.lua:17: attempt to compare number with nil" #145
Describe the bug
vim-illuminate: An internal error has occured: false"...packer/start/vim-illuminate/lua/illuminate/highlight.lua:17: attempt to compare number with nil"
To Reproduce
i want when i open large file, illuminate will use LSP or regex as backend, not treesitter, because if use treesitter the neovim will get stuck, so i add these to iiluminat config
large_file_cutoff = 1000,
-- large_file_config: config to use for large files (based on large_file_cutoff).
-- Supports the same keys passed to .configure
-- If nil, vim-illuminate will be disabled for large files.
large_file_overrides = {
providers = {
"lsp",
-- "treesitter",
"regex",
},
-- under_cursor = true,
delay = 100,
},
and i add some configures to treesitter, it will only be used when file is less than 100 kb, after this i use neovim open a large js file (echart.js) and neovim show me this
vim-illuminate: An internal error has occured: false"...packer/start/vim-illuminate/lua/illuminate/highlight.lua:17: attempt to compare number with nil"
and illuminate dose not working properly
Note Omitting a minimal init.vim/init.lua/.vimrc will likely result in the issue being closed without explanation.
minimal init.lua
local on_windows = vim.loop.os_uname().version:match("Windows")
local function join_paths(...)
local path_sep = on_windows and "\\" or "/"
local result = table.concat({ ... }, path_sep)
return result
end
vim.cmd([[set runtimepath=$VIMRUNTIME]])
local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"
temp_dir = temp_dir .. "/neovimtest"
vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))
local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")
local function load_plugins()
require("packer").startup({
function(use)
use("ajmwagar/vim-deus")
use("wbthomason/packer.nvim")
use({
"nvim-treesitter/nvim-treesitter",
run = function()
require("nvim-treesitter.install").update({ with_sync = true })
end,
})
use({
"RRethy/vim-illuminate",
})
end,
config = {
package_root = package_root,
compile_path = compile_path,
},
})
end
local function load_config()
vim.o.t_Co = 256
vim.o.termguicolors = true
vim.cmd([[colorscheme deus]])
local status, treesitter = pcall(require, "nvim-treesitter.configs")
if not status then
vim.notify("not found nvim-treesitter")
return
end
local filesize_hundle = function(_, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end
treesitter.setup({
-- Automatically install missing parsers when entering buffer
auto_install = true,
highlight = {
enable = true,
disable = filesize_hundle,
additional_vim_regex_highlighting = false,
-- list of language that will be disabled
-- disable = { "c", "rust" },
},
})
local illuminate
status, illuminate = pcall(require, "illuminate")
if not status then
vim.notify("not found illuminate")
return
end
illuminate.configure({
-- providers: provider used to get references in the buffer, ordered by priority
providers = {
-- "lsp",
"treesitter",
"regex",
},
-- delay: delay in milliseconds
delay = 100,
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
-- See `:help mode()` for possible values
modes_denylist = { "i" },
-- under_cursor: whether or not to illuminate under the cursor
under_cursor = true,
-- large_file_cutoff: number of lines at which to use large_file_config
-- The `under_cursor` option is disabled when this cutoff is hit
large_file_cutoff = 1000,
-- large_file_config: config to use for large files (based on large_file_cutoff).
-- Supports the same keys passed to .configure
-- If nil, vim-illuminate will be disabled for large files.
large_file_overrides = {
providers = {
-- "lsp",
-- "treesitter",
"regex",
},
-- under_cursor = true,
delay = 100,
},
-- min_count_to_highlight: minimum number of matches required to perform highlighting
min_count_to_highlight = 1,
})
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
load_plugins()
require("packer").sync()
local packer_group = vim.api.nvim_create_augroup("Packer", { clear = true })
vim.api.nvim_create_autocmd(
"User",
{ pattern = "PackerComplete", callback = load_config, group = packer_group, once = true }
)
else
load_plugins()
-- require("packer").sync()
load_config()
end
Output from :IlluminateDebug
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Describe the bug vim-illuminate: An internal error has occured: false"...packer/start/vim-illuminate/lua/illuminate/highlight.lua:17: attempt to compare number with nil"
To Reproduce i want when i open large file, illuminate will use LSP or regex as backend, not treesitter, because if use treesitter the neovim will get stuck, so i add these to iiluminat config
and i add some configures to treesitter, it will only be used when file is less than 100 kb, after this i use neovim open a large js file (echart.js) and neovim show me this
vim-illuminate: An internal error has occured: false"...packer/start/vim-illuminate/lua/illuminate/highlight.lua:17: attempt to compare number with nil"
and illuminate dose not working properlyNote Omitting a minimal
init.vim
/init.lua
/.vimrc
will likely result in the issue being closed without explanation. minimal init.luaOutput from
:IlluminateDebug
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.![image](https://user-images.githubusercontent.com/43649186/201292661-a2763487-13b8-47c2-8014-00bf4f5d590e.png)
Additional context Add any other context about the problem here.