Use nREPL sessions if output bug not present

A bug in the current version of nREPL doesn't send us *out* and *err* if
a session is used.  nREPL 0.2.0-RC2 promises to fix that.  When it does,
we'll start using sessions.

Closes #11.
This commit is contained in:
Tim Pope 2012-12-10 20:09:13 -05:00
parent 23fb876909
commit 9cd3653460

View File

@ -97,7 +97,13 @@ function! nrepl#foreplay_connection#open(arg) abort
let client = deepcopy(s:nrepl) let client = deepcopy(s:nrepl)
let client.host = host let client.host = host
let client.port = port let client.port = port
let client._path = client.eval('(symbol (str (System/getProperty "path.separator") (System/getProperty "java.class.path")))') let session = client.call({'op': 'clone'})[0]['new-session']
let response = client.call({'op': 'eval', 'session': session, 'code':
\ '(do (println "success") (symbol (str (System/getProperty "path.separator") (System/getProperty "java.class.path"))))'})
let client._path = response[-2]['value']
if len(response) == 3
let client.session = session
endif
return client return client
endfunction endfunction
@ -134,6 +140,9 @@ function! s:nrepl_eval(expr, ...) dict abort
elseif has_key(self, 'ns') elseif has_key(self, 'ns')
let payload.ns = self.ns let payload.ns = self.ns
endif endif
if has_key(self, 'session')
let payload.session = self.session
endif
let packet = self.process(payload) let packet = self.process(payload)
if has_key(packet, 'value') if has_key(packet, 'value')
if !a:0 if !a:0