mirror of
https://github.com/neovim/neovim.git
synced 2026-07-15 05:40:34 +00:00
fix(filetype): ensure directory bufname ends w/ slash sep #40552
Problem: `vim.filetype.match()` needs a cheap way to recognize directory buffers without doing filesystem stat work. Solution: Ensure full buffer names for directories end in a trailing slash. Now directory buffers can proceed through the normal 'filetype' path. Note side-effects: session and ShaDa buffer-list restore behavior must be compatible, so those + corresponding tests must be updated.
This commit is contained in:
@@ -73,6 +73,15 @@ describe('vim.filetype', function()
|
||||
)
|
||||
end)
|
||||
|
||||
it('detects directory filenames', function()
|
||||
eq(
|
||||
'directory',
|
||||
exec_lua(function()
|
||||
return vim.filetype.match({ filename = '/tmp/example/' })
|
||||
end)
|
||||
)
|
||||
end)
|
||||
|
||||
it('works without defined g:ft_ignore_pat', function()
|
||||
local match_opts = { filename = 'unknown-ft', buf = api.nvim_create_buf(false, true) }
|
||||
eq(
|
||||
|
||||
Reference in New Issue
Block a user