Skip to content

Commit 5c0c19a

Browse files
committed
Drop support for projections inside gems
To the best of my knowledge, zero gems have ever taken advantage of this. Replacement, in the unlikely event anyone needs it: let g:rails_gem_projections = {'foo': 'lib/projections.json'}
1 parent 2f8adae commit 5c0c19a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

autoload/rails.vim

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4600,7 +4600,6 @@ let s:has_projections = {
46004600
\ }
46014601
\}
46024602

4603-
let s:projections_for_gems = {}
46044603
function! s:app_projections() dict abort
46054604
let dict = s:combine_projections({}, s:default_projections)
46064605
for [k, v] in items(s:has_projections)
@@ -4612,25 +4611,26 @@ function! s:app_projections() dict abort
46124611
call s:combine_projections(dict, get(g:, 'rails_projections', ''))
46134612
for gem in keys(get(g:, 'rails_gem_projections', {}))
46144613
if self.has_gem(gem)
4615-
call s:combine_projections(dict, g:rails_gem_projections[gem])
4614+
try
4615+
if type(g:rails_gem_projections[gem]) ==# v:t_string
4616+
let file = g:rails_gem_projections[gem]
4617+
if file !~# '^\a\+:\|^/'
4618+
if !has_key(self.gems(), gem)
4619+
continue
4620+
endif
4621+
let file = self.gems()[gem] . '/' . file
4622+
endif
4623+
if file =~# '/$'
4624+
let file .= 'projections.json'
4625+
endif
4626+
call s:combine_projections(dict, rails#json_parse(s:readfile(file)))
4627+
else
4628+
call s:combine_projections(dict, g:rails_gem_projections[gem])
4629+
endif
4630+
catch
4631+
endtry
46164632
endif
46174633
endfor
4618-
let gem_path = escape(join(values(self.gems()),','), ' ')
4619-
if !empty(gem_path)
4620-
if !has_key(s:projections_for_gems, gem_path)
4621-
let gem_projections = {}
4622-
for path in ['lib/', 'lib/rails/']
4623-
for file in findfile(path.'projections.json', gem_path, -1)
4624-
try
4625-
call s:combine_projections(gem_projections, rails#json_parse(s:readfile(self.path(file))))
4626-
catch
4627-
endtry
4628-
endfor
4629-
endfor
4630-
let s:projections_for_gems[gem_path] = gem_projections
4631-
endif
4632-
call s:combine_projections(dict, s:projections_for_gems[gem_path])
4633-
endif
46344634
if self.cache.needs('projections')
46354635
call self.cache.set('projections', {})
46364636

0 commit comments

Comments
 (0)