Fix ansible ftdetect

This commit is contained in:
Adam Stankiewicz
2020-08-25 14:26:38 +02:00
parent e47af23f64
commit 080b8cdc60
4 changed files with 33 additions and 17 deletions

View File

@@ -0,0 +1,14 @@
function! TestExtension(filetype, filename, content)
try
exec "e " . a:filename
exec "if &filetype != '" . a:filetype . "' \nthrow &filetype\nendif"
catch
echo 'Filename "' . a:filename . '" does not resolve to extension "' . a:filetype . '"'
echo ' instead received: "' . v:exception . '"'
exec ':cq!'
endtry
endfunction
call TestExtension('blade', 'test.blade.php', '')
call TestExtension('yaml.ansible', 'playbook.yml', '')
call TestExtension('yaml.ansible', 'host_vars/foobar', '')