Skip to content

Commit 81575f6

Browse files
committed
Drop support for editor.json
1 parent 2b3d9fc commit 81575f6

File tree

1 file changed

+17
-45
lines changed

1 file changed

+17
-45
lines changed

autoload/rails.vim

Lines changed: 17 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4234,49 +4234,6 @@ function! rails#json_parse(string) abort
42344234
throw "invalid JSON: ".string
42354235
endfunction
42364236

4237-
function! s:app_config(...) dict abort
4238-
if self.cache.needs('config')
4239-
call self.cache.set('config', 0)
4240-
4241-
let projections = {}
4242-
if self.has_path('config/projections.json')
4243-
try
4244-
let projections = rails#json_parse(readfile(self.path('config/projections.json')))
4245-
catch /^invalid JSON:/
4246-
endtry
4247-
endif
4248-
4249-
if self.has_path('config/editor.json')
4250-
try
4251-
let config = rails#json_parse(readfile(self.path('config/editor.json')))
4252-
if !has_key(config, 'projections')
4253-
let config.projections = projections
4254-
endif
4255-
call self.cache.set('config', config)
4256-
catch /^invalid JSON:/
4257-
call s:error("Couldn't parse config/editor.json")
4258-
endtry
4259-
elseif !empty(projections)
4260-
call self.cache.set('config', {'projections': projections})
4261-
endif
4262-
4263-
endif
4264-
if type(self.cache.get('config')) == type({})
4265-
let config = self.cache.get('config')
4266-
elseif exists('g:rails_default_config')
4267-
let config = g:rails_default_config
4268-
else
4269-
let config = {}
4270-
endif
4271-
if a:0
4272-
let default = a:0 > 1 ? a:2 : {}
4273-
let value = get(config, a:1, default)
4274-
return type(value) == type(default) ? value : default
4275-
else
4276-
return config
4277-
endif
4278-
endfunction
4279-
42804237
function! s:app_gems() dict abort
42814238
if self.has('bundler') && exists('*bundler#project')
42824239
return bundler#project(self.path()).gems()
@@ -4385,11 +4342,26 @@ function! s:app_projections() dict abort
43854342
endif
43864343
call s:combine_projections(dict, s:projections_for_gems[gem_path])
43874344
endif
4388-
call s:combine_projections(dict, get(self.config(), 'projections', ''))
4345+
if self.cache.needs('projections')
4346+
call self.cache.set('config', {})
4347+
4348+
let projections = {}
4349+
if self.has_path('config/projections.json')
4350+
try
4351+
let projections = rails#json_parse(readfile(self.path('config/projections.json')))
4352+
if type(projections) == type({})
4353+
call self.cache.set('projections', projections)
4354+
endif
4355+
catch /^invalid JSON:/
4356+
endtry
4357+
endif
4358+
endif
4359+
4360+
call s:combine_projections(dict, self.cache.get('projections'))
43894361
return dict
43904362
endfunction
43914363

4392-
call s:add_methods('app', ['config', 'gems', 'has_gem', 'engines', 'projections'])
4364+
call s:add_methods('app', ['gems', 'has_gem', 'engines', 'projections'])
43934365

43944366
function! s:expand_placeholders(string, placeholders)
43954367
if type(a:string) !=# type('')

0 commit comments

Comments
 (0)