lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.27k stars 106 forks source link

indent_line causing error in .c files #954

Closed austinDaily closed 4 days ago

austinDaily commented 4 days ago

Problem

I opened up a .c file in nvim today and was hit with this error:

Error executing lua callback: /usr/local/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SNR>
1_LoadFTPlugin[20]..script /home/snowdaemon/.local/share/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua: Vim(runtime):E5113: Error while calling lua c
hunk: .../share/nvim/lazy/indent-blankline.nvim/lua/ibl/utils.lua:22: type: expected function: 0x7cb07c846738, got string (SKIP_LINE)
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        .../share/nvim/lazy/indent-blankline.nvim/lua/ibl/utils.lua:22: in function 'validate'
        .../share/nvim/lazy/indent-blankline.nvim/lua/ibl/hooks.lua:61: in function 'register'
        ...are/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua:3: in main chunk
        [C]: in function 'nvim_cmd'
        /usr/local/share/nvim/runtime/filetype.lua:36: in function </usr/local/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'pcall'
        vim/shared.lua: in function <vim/shared.lua:0>
        [C]: in function '_with'
        /usr/local/share/nvim/runtime/filetype.lua:35: in function </usr/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function '_with'
        /usr/local/share/nvim/runtime/filetype.lua:35: in function </usr/local/share/nvim/runtime/filetype.lua:10>
Press ENTER or type command to continue                                                                                                                                                                                                                        Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/local/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SNR>
1_LoadFTPlugin[20]..script /home/snowdaemon/.local/share/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua: Vim(runtime):E5113: Error while calling lua c
hunk: .../share/nvim/lazy/indent-blankline.nvim/lua/ibl/utils.lua:22: type: expected function: 0x7cb07c846738, got string (SKIP_LINE)
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        .../share/nvim/lazy/indent-blankline.nvim/lua/ibl/utils.lua:22: in function 'validate'
        .../share/nvim/lazy/indent-blankline.nvim/lua/ibl/hooks.lua:61: in function 'register'
        ...are/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua:3: in main chunk
        [C]: in function 'nvim_cmd'
        /usr/local/share/nvim/runtime/filetype.lua:36: in function </usr/local/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'pcall'
        vim/shared.lua: in function <vim/shared.lua:0>
        [C]: in function '_with'
        /usr/local/share/nvim/runtime/filetype.lua:35: in function </usr/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function '_with'
        /usr/local/share/nvim/runtime/filetype.lua:35: in function </usr/local/share/nvim/runtime/filetype.lua:10>
Press ENTER or type command to continue

This is only occurring in .c files. All other filetypes are working like normal.

My indent_blankline config came default with tjdevries kickstart.nvim, and I haven't touched it since I cloned Kickstart 6 or so months ago. It is a simple config:

return {
  { -- Add indentation guides even on blank lines
    'lukas-reineke/indent-blankline.nvim',
    -- Enable lukas-reineke/indent-blankline.nvim
    -- See :help ibl
    main = 'ibl',
    opts = {},
  },
}

I have programmed plenty of C since then as well, and have never had this problem.

I temporarily fixed the issue by moving the file mentioned in the error message (~/.local/share/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua) to a backup.

mv ~/.local/share/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua.bak ~/.local/share/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua

The contents of the (~/.local/share/nvim/lazy/indent-blankline.nvim/after/ftplugin/c.lua) are also very simple:

local hooks = require "ibl.hooks"

hooks.register(hooks.type.SKIP_LINE, hooks.builtin.skip_preproc_lines, { bufnr = 0 })

I'm pretty confident I didn't mess with any configuration. So I'm assuming this happened because of an update. If this is a stupid issue and/or I just made a stupid mistake, please let me know. I would like any suggestions for a permanent fix.

I'm on indent_blankline v3.8.5

Steps to reproduce

nvim hello.c

Expected behavior

I expect neovim to open without error and indent_blankline to work in a .c file.

Neovim version (nvim -v)

v0.11.0

lukas-reineke commented 4 days ago

Duplicate of #936 Please make sure your Neovim version is up to date