filetype.nvim icon indicating copy to clipboard operation
filetype.nvim copied to clipboard

Unknown function: dist#ft# FTVB

Open shaeinst opened this issue 2 years ago • 8 comments

i am getting this error on opening .bas file

full error

               Error detected while processing BufNewFile Autocommands for "*":                                                       
E5108: Error executing lua ...r/start/filetype.nvim/lua/filetype/mappings/function.lua:256: Vim(call):E117: Unknown function: dist#ft#
FTVB                                                                                                                                  
stack traceback:                                                                                                                      
        [C]: in function 'cmd'                                                                                                        
        ...r/start/filetype.nvim/lua/filetype/mappings/function.lua:256: in function 'name'                                           
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:17: in function 'set_filetype'                                    
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:65: in function 'try_lookup'                                      
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:168: in function 'resolve'                                        
        [string ":lua"]:1: in main chunk  

shaeinst avatar Aug 25 '22 06:08 shaeinst

I've been having the same issue, this may be a rough workaround but I managed to avoid this error by using the following configuration:

local filetype_ok, filetype = pcall(require, "filetype")
if not filetype_ok then
    vim.api.nvim_command([[echoerr "Error while loading filetype.nvim"]])
	return
end

filetype.setup({
    overrides = {
        extensions = {
            bas = "basic"
        }
    }
})

-- Do not source the default filetype.vim
vim.g.did_load_filetypes = 1

Penaz91 avatar Oct 24 '22 09:10 Penaz91

I was just coming to report the same error, since I finally took the time to figure out what was breaking.

I was able to open javascript files just fine, but typescript or .sh files were where I was getting the errors.

I did try the solution suggested by @Penaz91, and I'm not getting errors for *.ts files anymore, but I am still getting them for *.sh files

jmiln avatar Nov 28 '22 21:11 jmiln

Neovim removed the flie that defined these functions in https://github.com/neovim/neovim/commit/042eb74ff1ed63d79f8a642649cd6be6ec4b0eb9. The plugin should be updated to use the new filetype detection functions.

Xevnar avatar Nov 29 '22 11:11 Xevnar

I've got the same issue since a couple of weeks.

I've been having the same issue, this may be a rough workaround but I managed to avoid this error by using the following configuration:

local filetype_ok, filetype = pcall(require, "filetype")
if not filetype_ok then
    vim.api.nvim_command([[echoerr "Error while loading filetype.nvim"]])
	return
end

filetype.setup({
    overrides = {
        extensions = {
            bas = "basic"
        }
    }
})

-- Do not source the default filetype.vim
vim.g.did_load_filetypes = 1

Is only to get rid of the error but does not solve any highlighting or code completion issues.

Philwi avatar Nov 30 '22 11:11 Philwi

I've got the same issue since a couple of weeks.

I've been having the same issue, this may be a rough workaround but I managed to avoid this error by using the following configuration:

local filetype_ok, filetype = pcall(require, "filetype")
if not filetype_ok then
    vim.api.nvim_command([[echoerr "Error while loading filetype.nvim"]])
	return
end

filetype.setup({
    overrides = {
        extensions = {
            bas = "basic"
        }
    }
})

-- Do not source the default filetype.vim
vim.g.did_load_filetypes = 1

Is only to get rid of the error but does not solve any highlighting or code completion issues.

especially if you pair it with auto-session plugin, you get error everytime it tries to restore session

tekpriest avatar Nov 30 '22 17:11 tekpriest

I get the same issue trying to open .html files. I found a temporary solution to add line:

["html"] = "html", 

to mappings/extensions.lua file.

This seem to work with other currently broken extensions as well. Highlighting and autocompletion works for me.

This is probably just the same answer as above, I'm not very into lua.

tmvfb avatar Mar 03 '23 15:03 tmvfb

FWIW, newer versions of nvim have their own "filetype lua script" integrated which can be activated as follows:

vim.g.do_filetype_lua = true
vim.g.did_load_filetypes = false

You can see more here: https://neovim.discourse.group/t/introducing-filetype-lua-and-a-call-for-help/1806

Penaz91 avatar Mar 03 '23 19:03 Penaz91

Adding to @Penaz91's comment, if you're using Nvim v0.8+, filetype.lua is already enabled by default, so there is no need to add the suggested lines to your configuration.

seandewar avatar Jul 12 '23 17:07 seandewar