Ruby remote plugin support

This commit is contained in:
Alex Genco 2016-03-10 18:56:47 -08:00
parent bb020df0f5
commit 3cb9970acf
3 changed files with 51 additions and 7 deletions

View File

@ -27,13 +27,8 @@ function! provider#pythonx#Require(host) abort
echomsg v:throwpoint echomsg v:throwpoint
echomsg v:exception echomsg v:exception
endtry endtry
throw 'Failed to load '. a:host.orig_name . ' host. '. throw remote#host#LoadErrorForHost(a:host.orig_name,
\ 'You can try to see what happened '. \ '$NVIM_PYTHON_LOG_FILE')
\ 'by starting Neovim with the environment variable '.
\ '$NVIM_PYTHON_LOG_FILE set to a file and opening '.
\ 'the generated log file. Also, the host stderr will be available '.
\ 'in Neovim log, so it may contain useful information. '.
\ 'See also ~/.nvimlog.'
endfunction endfunction
function! provider#pythonx#Detect(major_ver) abort function! provider#pythonx#Detect(major_ver) abort

View File

@ -0,0 +1,34 @@
" The Ruby provider helper
if exists('s:loaded_ruby_provider')
finish
endif
let s:loaded_ruby_provider = 1
function! provider#ruby#Require(host) abort
" Collect registered Ruby plugins into args
let args = []
let ruby_plugins = remote#host#PluginsForHost(a:host.name)
for plugin in ruby_plugins
call add(args, plugin.path)
endfor
try
let channel_id = rpcstart(provider#ruby#Prog(), args)
if rpcrequest(channel_id, 'poll') == 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name,
\ '$NVIM_RUBY_LOG_FILE')
endfunction
function! provider#ruby#Prog() abort
return 'neovim-ruby-host'
endfunction

View File

@ -204,6 +204,17 @@ function! remote#host#PluginsForHost(host) abort
endfunction endfunction
function! remote#host#LoadErrorForHost(host, log) abort
return 'Failed to load '. a:host . ' host. '.
\ 'You can try to see what happened '.
\ 'by starting Neovim with the environment variable '.
\ a:log . ' set to a file and opening the generated '.
\ 'log file. Also, the host stderr will be available '.
\ 'in Neovim log, so it may contain useful information. '.
\ 'See also ~/.nvimlog.'
endfunction
" Registration of standard hosts " Registration of standard hosts
" Python/Python3 " Python/Python3
@ -211,3 +222,7 @@ call remote#host#Register('python', '*.py',
\ function('provider#pythonx#Require')) \ function('provider#pythonx#Require'))
call remote#host#Register('python3', '*.py', call remote#host#Register('python3', '*.py',
\ function('provider#pythonx#Require')) \ function('provider#pythonx#Require'))
" Ruby
call remote#host#Register('ruby', '*.rb',
\ function('provider#ruby#Require'))