Merge pull request #152 from jgdavey/brepl
Browser piggieback connection convenience
This commit is contained in:
commit
049005dec7
@ -40,7 +40,10 @@ properly, and that not all operations are supported.
|
||||
cemerick.piggieback/cljs-repl with the given or
|
||||
default (Rhino) environment. This will also happen
|
||||
automatically on first eval in a ClojureScript buffer
|
||||
if not invoked explicitly.
|
||||
if not invoked explicitly. If {env} is a number, the
|
||||
piggieback repl-env will will use a cljs.repl.browser
|
||||
(rather than a Rhino) env with the port set to the
|
||||
number provided.
|
||||
|
||||
:Piggieback! Terminate the most recently created piggieback
|
||||
session.
|
||||
|
@ -212,12 +212,17 @@ function! s:repl.piggieback(arg, ...) abort
|
||||
endif
|
||||
return {}
|
||||
endif
|
||||
|
||||
let connection = s:conn_try(self.connection, 'clone')
|
||||
if empty(a:arg)
|
||||
let arg = ''
|
||||
elseif a:arg =~# '^\d\{1,5}$'
|
||||
call connection.eval("(require 'cljs.repl.browser)")
|
||||
let port = matchstr(a:arg, '^\d\{1,5}$')
|
||||
let arg = ' :repl-env (cljs.repl.browser/repl-env :port '.port.')'
|
||||
else
|
||||
let arg = ' :repl-env ' . a:arg
|
||||
endif
|
||||
let connection = s:conn_try(self.connection, 'clone')
|
||||
let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')')
|
||||
|
||||
if empty(get(response, 'ex'))
|
||||
|
Loading…
Reference in New Issue
Block a user