Change :Piggieback behavior for empty/port parameters
- Explicitly specify Rhino REPL when :Piggieback has no parameters - Use Weasel REPL when port parameter is provided to :Piggieback - Improve leading space handling for :Piggieback params - Fall back to cljs.repl.browser if Weasel in not in classpath - Use has_key() when checking for Weasel repl availability
This commit is contained in:
parent
04a7f542f5
commit
3474bd5d72
@ -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)))
|
||||||
|
Loading…
Reference in New Issue
Block a user