Skip to content

Commit a6dce38

Browse files
committed
Extract alternate fixtures extensions from projections
1 parent d38f1bf commit a6dce38

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

autoload/rails.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3062,7 +3062,12 @@ function! s:fixturesEdit(cmd,...)
30623062
if file =~ '\.\w\+$' && rails#app().find_file(c.e, dirs, []) ==# ''
30633063
return s:edit(a:cmd,file)
30643064
else
3065-
return s:open(a:cmd, rails#app().find_file(c.e, dirs, ['.yml', '.csv', '.rb'], file))
3065+
let exts = ['.yml','.csv','.rb']
3066+
call extend(exts,
3067+
\ filter(map(keys(filter(copy(rails#app().projections()), 'get(v:val, "type") is# "fixtures"')),
3068+
\ 'matchstr(v:val, "^\\C\\%(test\\|spec\\)/factories/\\*\\zs.\\+$")'), 'len(v:val)'))
3069+
call s:uniq(exts)
3070+
return s:open(a:cmd, rails#app().find_file(c.e, dirs, exts, file))
30663071
endif
30673072
endfunction
30683073

0 commit comments

Comments
 (0)