Merge pull request #239 from siphiuel/master

Change :Piggieback behavior for empty/port parameters
This commit is contained in:
Tim Pope 2015-10-02 12:12:42 -04:00
commit 8579a41a18

View File

@ -277,15 +277,19 @@ function! s:repl.piggieback(arg, ...) abort
let connection = s:conn_try(self.connection, 'clone') let connection = s:conn_try(self.connection, 'clone')
if empty(a:arg) if empty(a:arg)
let arg = '' let arg = '(cljs.repl.rhino/repl-env)'
elseif a:arg =~# '^\d\{1,5}$' elseif a:arg =~# '^\d\{1,5}$'
call connection.eval("(require 'cljs.repl.browser)") let replns = 'weasel.repl.websocket'
let port = matchstr(a:arg, '^\d\{1,5}$') if has_key(connection.eval("(require '" . replns . ")"), 'ex')
let arg = ' (cljs.repl.browser/repl-env :port '.port.')' let replns = 'cljs.repl.browser'
else call connection.eval("(require '" . replns . ")")
let arg = ' ' . a:arg
endif endif
let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')') let port = matchstr(a:arg, '^\d\{1,5}$')
let arg = '('.replns.'/repl-env :port '.port.')'
else
let arg = a:arg
endif
let response = connection.eval('(cemerick.piggieback/cljs-repl'.' '.arg.')')
if empty(get(response, 'ex')) if empty(get(response, 'ex'))
call insert(self.piggiebacks, extend({'connection': connection}, deepcopy(s:piggieback))) call insert(self.piggiebacks, extend({'connection': connection}, deepcopy(s:piggieback)))