Permalink
Browse files

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.
  • Loading branch information...
1 parent 23fb876 commit 9cd365346008bd5ab21579cb50ef97b4e9dadc79 @tpope committed Dec 11, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 autoload/nrepl/foreplay_connection.vim
@@ -97,7 +97,13 @@ function! nrepl#foreplay_connection#open(arg) abort
let client = deepcopy(s:nrepl)
let client.host = host
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
endfunction
@@ -134,6 +140,9 @@ function! s:nrepl_eval(expr, ...) dict abort
elseif has_key(self, 'ns')
let payload.ns = self.ns
endif
+ if has_key(self, 'session')
+ let payload.session = self.session
+ endif
let packet = self.process(payload)
if has_key(packet, 'value')
if !a:0

0 comments on commit 9cd3653

Please sign in to comment.