Default to sending session id
This commit is contained in:
parent
77df83250f
commit
023c8573ab
@ -62,7 +62,7 @@ function! nrepl#fireplace_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 session = client.process({'op': 'clone'})['new-session']
|
let session = client.process({'op': 'clone', 'session': 0})['new-session']
|
||||||
let response = client.process({'op': 'eval', 'session': session, 'code':
|
let response = client.process({'op': 'eval', 'session': session, 'code':
|
||||||
\ '(do (println "success") (symbol (str (System/getProperty "path.separator") (System/getProperty "java.class.path"))))'})
|
\ '(do (println "success") (symbol (str (System/getProperty "path.separator") (System/getProperty "java.class.path"))))'})
|
||||||
let client._path = response.value[-1]
|
let client._path = response.value[-1]
|
||||||
@ -116,14 +116,8 @@ 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 get(options, 'session', 1)
|
if has_key(options, 'session')
|
||||||
if has_key(self, 'session')
|
let payload.session = options.session
|
||||||
let payload.session = self.session
|
|
||||||
elseif &verbose
|
|
||||||
echohl WarningMSG
|
|
||||||
echo "nREPL: server has bug preventing session support"
|
|
||||||
echohl None
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
if has_key(options, 'file_path')
|
if has_key(options, 'file_path')
|
||||||
let payload.op = 'load-file'
|
let payload.op = 'load-file'
|
||||||
@ -142,7 +136,7 @@ function! s:nrepl_eval(expr, ...) dict abort
|
|||||||
let self.ns = response.ns
|
let self.ns = response.ns
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has_key(response, 'ex') && has_key(payload, 'session')
|
if has_key(response, 'ex') && !empty(get(payload, 'session', 1))
|
||||||
let response.stacktrace = s:extract_last_stacktrace(self)
|
let response.stacktrace = s:extract_last_stacktrace(self)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -176,7 +170,20 @@ function! s:nrepl_dispatch(command, ...) dict abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:nrepl_call(payload) dict abort
|
function! s:nrepl_call(payload) dict abort
|
||||||
return self.dispatch('call', nrepl#fireplace_connection#bencode(a:payload))
|
let payload = copy(a:payload)
|
||||||
|
if empty(get(payload, 'session', 1))
|
||||||
|
unlet payload.session
|
||||||
|
elseif !has_key(self, 'session')
|
||||||
|
if &verbose
|
||||||
|
echohl WarningMSG
|
||||||
|
echo "nREPL: server has bug preventing session support"
|
||||||
|
echohl None
|
||||||
|
endif
|
||||||
|
unlet! payload.session
|
||||||
|
elseif !has_key(payload, 'session')
|
||||||
|
let payload.session = self.session
|
||||||
|
endif
|
||||||
|
return self.dispatch('call', nrepl#fireplace_connection#bencode(payload))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:nrepl = {
|
let s:nrepl = {
|
||||||
|
@ -272,7 +272,7 @@ let s:oneoff_out = tempname()
|
|||||||
let s:oneoff_err = tempname()
|
let s:oneoff_err = tempname()
|
||||||
|
|
||||||
function! s:oneoff.eval(expr, options) dict abort
|
function! s:oneoff.eval(expr, options) dict abort
|
||||||
if &verbose && get(a:options, 'session', 1)
|
if &verbose && !empty(get(a:options, 'session', 1))
|
||||||
echohl WarningMSG
|
echohl WarningMSG
|
||||||
echomsg "No REPL found. Running java clojure.main ..."
|
echomsg "No REPL found. Running java clojure.main ..."
|
||||||
echohl None
|
echohl None
|
||||||
@ -494,7 +494,7 @@ function! s:qfhistory() abort
|
|||||||
return list
|
return list
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fireplace#eval(expr, ...) abort
|
function! fireplace#session_eval(expr, ...) abort
|
||||||
let response = s:eval(a:expr, a:0 ? a:1 : {})
|
let response = s:eval(a:expr, a:0 ? a:1 : {})
|
||||||
|
|
||||||
if !empty(get(response, 'value', '')) || !empty(get(response, 'err', ''))
|
if !empty(get(response, 'value', '')) || !empty(get(response, 'err', ''))
|
||||||
@ -526,8 +526,8 @@ function! fireplace#eval(expr, ...) abort
|
|||||||
throw err
|
throw err
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fireplace#session_eval(expr, ...) abort
|
function! fireplace#eval(expr, ...) abort
|
||||||
return fireplace#eval(a:expr, extend({'session': 1}, a:0 ? a:1 : {}))
|
return fireplace#eval(a:expr, extend({'session': 0}, a:0 ? a:1 : {}))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fireplace#echo_session_eval(expr, ...) abort
|
function! fireplace#echo_session_eval(expr, ...) abort
|
||||||
|
Loading…
Reference in New Issue
Block a user