Skip to content

Commit

Permalink
Delegate to rails.vim rake completion when possible
Browse files Browse the repository at this point in the history
Should provide identical results, but allows rails.vim to handle
caching.
  • Loading branch information
tpope committed Jun 17, 2014
1 parent 135fb93 commit 7abfed7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plugin/rake.vim
Expand Up @@ -428,12 +428,16 @@ function! s:RakeComplete(A, L, P, ...) abort
endfunction

function! CompilerComplete_rake(A, L, P)
let path = fnamemodify(findfile('Rakefile', escape(getcwd(), ' ,;').';'), ':h')
if !empty(path)
return s:RakeComplete(a:A, a:L, a:P, s:project(path))
else
let path = findfile('Rakefile', escape(getcwd(), ' ,;').';')
if empty(path)
return []
endif
let path = fnamemodify(path, ':p:h')
if path ==# get(b:, 'rails_root', 'x') && exists('*rails#complete_rake')
return rails#complete_rake(a:A, a:L, a:P)
else
return s:RakeComplete(a:A, a:L, a:P, s:project(path))
endif
endfunction

function! s:project_tasks() dict abort
Expand Down

0 comments on commit 7abfed7

Please sign in to comment.