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.23k
stars
53
forks
source link
"out of range" error raised when hilighting lua region blocks #172
Describe the bug
"out of range" error raised when hilighting lua region blocks
To Reproduce
config(LazyVim):
{
"RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" },
opts = {
delay = 200,
under_cursor = true,
large_file_cutoff = 200,
large_file_overrides = {
providers = { "lsp", "treesitter", "regex" },
},
},
config = function(_, opts)
require("illuminate").configure(opts)
local function map(key, dir, buffer)
vim.keymap.set("n", key, function()
require("illuminate")["goto_" .. dir .. "_reference"](false)
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
end
map("]]", "next")
map("[[", "prev")
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
vim.api.nvim_create_autocmd("FileType", {
callback = function()
local buffer = vim.api.nvim_get_current_buf()
map("]]", "next", buffer)
map("[[", "prev", buffer)
end,
})
end,
keys = {
{ "]]", desc = "Next Reference" },
{ "[[", desc = "Prev Reference" },
},
},
text:
-- #region local functions
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
--- This file is automatically loaded by lazyvim.config.init
local Util = require("lazyvim.util")
local keymap = require("util").keymap
local cmd_concat = require("util").cmd_concat
local is_disabled_plugin = require("util").is_disabled_plugin
local _opts = { silent = true }
-- #endregion local functions
Note Omitting a minimal init.vim/init.lua/.vimrc will likely result in the issue being closed without explanation.
Output from :IlluminateDebug
Error 07:59:39 HKT msg_show.emsg Illuminate E464: Ambiguous use of user-defined command
Error 07:59:19 HKT notify.error vim-illuminate: An internal error has occured: false"...re/nvim/lazy/vim-illuminate/lua/illuminate/highlight.lua:40: Invalid 'line': out of range"
Expected behavior
A clear and concise description of what you expected to happen.
hilight the region block without error
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Describe the bug "out of range" error raised when hilighting lua region blocks
To Reproduce config(LazyVim):
text:
Note Omitting a minimal
init.vim
/init.lua
/.vimrc
will likely result in the issue being closed without explanation.Output from
:IlluminateDebug
Expected behavior A clear and concise description of what you expected to happen. hilight the region block without error
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.