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.19k stars 50 forks source link

When the file text is too long, there is a problem #151

Closed tengtengh closed 1 year ago

tengtengh commented 1 year ago

Describe the bug When the file text is too long, there is a problem

E339:Pattern too long
vim-illuminate: An internal error has occured: false".../start/vim-illuminate/lua/illuminate/providers/regex.lua:26: regex: internal error"

Screenshots Screenshots

If I disable the text file type, although it will not report an error, the cursor movement in the file will become stuck.

require('illuminate').configure({
    filetypes_denylist = {
        'text',
        'NvimTree',
        'dirvish',
        'fugitive',
    },
    -- filetypes_allowlist = {
    --     'cpp',
    --     'py',
    -- },
})

Operating System

ubuntu 22.04 wslg

vim version

NVIM v0.9.0-dev-604+g5b22b32e5
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/teng/Atengh/app_and_lib/neovim/build/cmake.config -I/home/teng/Atengh/app_and_lib/neovim/src -I/home/teng/Atengh/app_and_lib/neovim/.deps/usr/include -I/usr/include -I/home/teng/Atengh/app_and_lib/neovim/build/src/nvim/auto -I/home/teng/Atengh/app_and_lib/neovim/build/include 

Compiled by teng@tengh
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
Run :checkhealth for more info
RRethy commented 1 year ago

The issue is likely an internal Neovim error with lines that are too long, in the screenshot I don't see how long the line is, can you share that info? Something :echo col('$').

tengtengh commented 1 year ago

This is the file, 1 line, 999999 columns

test_input.txt

If I disable this plugin, nvim doesn't have any problem.

RRethy commented 1 year ago

This is the file, 1 line, 999999 columns

Yup that might do it.

If I disable this plugin, nvim doesn't have any problem.

To be clear, when I say internal I mean internal to vim.regex which is used by vim-illuminate.

I'll push a check for large lines later.

tengtengh commented 1 year ago

Well, even with the plugin disabled, nvim still slows down when encountering large lines. It's really not a plugin problem

RRethy commented 1 year ago

Reopening, I do have changes I want to add relating to this even if it won't fully fix the issue.