fix(filetype): make vim.filetype.match() work with contents only (#22181)

Co-authored-by: Gregory Anders <greg@gpanders.com>
This commit is contained in:
Jonas Strittmatter
2023-02-11 16:08:33 +01:00
committed by GitHub
parent 24ec0aaa7a
commit 9668c166e8
2 changed files with 57 additions and 48 deletions

View File

@@ -94,6 +94,14 @@ describe('vim.filetype', function()
return vim.filetype.match({ buf = 0 })
]])
end)
it('works with contents #22180', function()
eq('sh', exec_lua [[
-- Needs to be set so detect#sh doesn't fail
vim.g.ft_ignore_pat = "\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$"
return vim.filetype.match({ contents = { '#!/usr/bin/env bash' } })
]])
end)
end)
describe('filetype.lua', function()