Remove require from client interface
This commit is contained in:
parent
15f98b06f7
commit
ef422f66e2
@ -155,14 +155,26 @@ function! s:repl.try(function, ...) dict abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repl.eval(expr, options) dict abort
|
function! s:repl.eval(expr, options) dict abort
|
||||||
|
if has_key(a:options, 'ns') && a:options.ns !=# self.user_ns()
|
||||||
|
let error = self.preload(a:options.ns)
|
||||||
|
if !empty(error)
|
||||||
|
return error
|
||||||
|
endif
|
||||||
|
endif
|
||||||
return self.try('eval', a:expr, a:options)
|
return self.try('eval', a:expr, a:options)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repl.message(...) dict abort
|
function! s:repl.message(payload, ...) dict abort
|
||||||
return call(self.try, ['message'] + a:000, self)
|
if has_key(a:payload, 'ns') && a:payload.ns !=# self.user_ns()
|
||||||
|
let error = self.preload(a:payload.ns)
|
||||||
|
if !empty(error)
|
||||||
|
return error
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return call(self.try, ['message', a:payload] + a:000, self)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repl.require(lib) dict abort
|
function! s:repl.preload(lib) dict abort
|
||||||
if !empty(a:lib) && a:lib !=# self.user_ns() && !get(self.requires, a:lib)
|
if !empty(a:lib) && a:lib !=# self.user_ns() && !get(self.requires, a:lib)
|
||||||
let reload = has_key(self.requires, a:lib) ? ' :reload' : ''
|
let reload = has_key(self.requires, a:lib) ? ' :reload' : ''
|
||||||
let self.requires[a:lib] = 0
|
let self.requires[a:lib] = 0
|
||||||
@ -336,10 +348,6 @@ function! s:oneoff.eval(expr, options) dict abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:oneoff.require(symbol) abort
|
|
||||||
return {}
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:oneoff.message(symbol) abort
|
function! s:oneoff.message(symbol) abort
|
||||||
throw 'No live REPL connection'
|
throw 'No live REPL connection'
|
||||||
endfunction
|
endfunction
|
||||||
@ -409,9 +417,6 @@ function! fireplace#message(payload, ...)
|
|||||||
let payload = copy(a:payload)
|
let payload = copy(a:payload)
|
||||||
if !has_key(payload, 'ns')
|
if !has_key(payload, 'ns')
|
||||||
let payload.ns = fireplace#ns()
|
let payload.ns = fireplace#ns()
|
||||||
if fireplace#ns() !=# client.user_ns()
|
|
||||||
let error = client.require(fireplace#ns())
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
return call(client.message, [payload] + a:000, client)
|
return call(client.message, [payload] + a:000, client)
|
||||||
endfunction
|
endfunction
|
||||||
@ -483,12 +488,6 @@ function! s:eval(expr, ...) abort
|
|||||||
let options = a:0 ? copy(a:1) : {}
|
let options = a:0 ? copy(a:1) : {}
|
||||||
let client = fireplace#client()
|
let client = fireplace#client()
|
||||||
if !has_key(options, 'ns')
|
if !has_key(options, 'ns')
|
||||||
if fireplace#ns() !=# client.user_ns()
|
|
||||||
let error = client.require(fireplace#ns())
|
|
||||||
if !empty(error)
|
|
||||||
return error
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
let options.ns = fireplace#ns()
|
let options.ns = fireplace#ns()
|
||||||
endif
|
endif
|
||||||
return client.eval(a:expr, options)
|
return client.eval(a:expr, options)
|
||||||
|
Loading…
Reference in New Issue
Block a user