Skip to content

Commit a0f2e8c

Browse files
committed
Support Rails 5 enhancements in :Rails
1 parent c96ed72 commit a0f2e8c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

autoload/rails.vim

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ function! s:app_has(feature) dict
867867
\'bundler': 'Gemfile|gems.locked',
868868
\'rails2': 'script/about',
869869
\'rails3': 'config/application.rb',
870+
\'rails5': 'app/assets/config/manifest.js|config/initializers/application_controller_renderer.rb',
870871
\'cucumber': 'features/',
871872
\'turnip': 'spec/acceptance/',
872873
\'sass': 'public/stylesheets/sass/',
@@ -1893,7 +1894,13 @@ function! rails#complete_rails(ArgLead, CmdLine, P, ...) abort
18931894
elseif empty(app)
18941895
return s:completion_filter(['new'], a:ArgLead)
18951896
elseif cmd =~# '^\w*$'
1896-
return s:completion_filter(['generate', 'console', 'server', 'dbconsole', 'application', 'destroy', 'plugin', 'runner'],a:ArgLead)
1897+
let cmds = ['generate', 'console', 'server', 'dbconsole', 'destroy', 'plugin', 'runner']
1898+
if app.has('rails5')
1899+
call extend(cmds, app.rake_tasks())
1900+
endif
1901+
return s:completion_filter(cmds, a:ArgLead)
1902+
elseif cmd =~# '^\%([rt]\|runner\|test\|test:db\)\s\+'
1903+
return s:completion_filter(app.relglob('', s:fuzzyglob(a:ArgLead)), a:ArgLead)
18971904
elseif cmd =~# '^\%([gd]\|generate\|destroy\)\s\+'.a:ArgLead.'$'
18981905
return s:completion_filter(app.generators(),a:ArgLead)
18991906
elseif cmd =~# '^\%([gd]\|generate\|destroy\)\s\+\w\+\s\+'.a:ArgLead.'$'

compiler/rails.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CompilerSet errorformat^=
3939
\%+G\ %#Code\ LOC:\ %.%#,
4040
\%+GAbout\ your\ application's\ environment,
4141
\%+Grun\ %\\S%#::Application.routes,
42+
\%+Irails\ %\\S%\\+%\\s%\\+#\ %.%#,
4243
\%+Eruby:%.%#(LoadError),
4344
\%+EUsage:%.%#,
4445
\%+ECould\ not\ find\ generator%.%#,

0 commit comments

Comments
 (0)