Skip to content

filetype.detect spend a lot of time when file is a big binary #307

@fcying

Description

@fcying

nvim-telescope/telescope.nvim#1637

when I use Telescope find_files select a big binary file, filetype.detect spend a lot of time and freezes nvim.

Conni2461 :
For me it spends 20 seconds in filetype detect (so a plenary issue). Because it reads the head (first line) of the file and looks for a shebang.

Better idea. Lets not read until \n. Lets just read the first n bytes (128 or 256) and then check for a shebang

test file
ccls_test_telescop.zip

============================================================================
update[01/21]
block in filetype.detect_from_modeline (filetype.lua +172)
if i disable this check, work fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions