Public Variables and Functions
function
Usage: (client transport response-timeout)
Returns a fn of zero and one argument, both of which return the current head of a single
response-seq being read off of the given client-side transport. The one-arg arity will
send a given message on the transport before returning the seq.
Most REPL interactions are best performed via `message` and `client-session` on top of
a client fn returned from this fn.
Source
function
Usage: (client-session client & {:keys [session clone]})
Returns a function of one argument. Accepts a message that is sent via the
client provided with a fixed :session id added to it. Returns the
head of the client's response seq, filtered to include only
messages related to the :session id that will terminate when the session is
closed.
Source
macro
Usage: (code & body)
Expands into a string consisting of the macro's body's forms
(literally, no interpolation/quasiquoting of locals or other
references), suitable for use in an :eval message, e.g.:
{:op :eval, :code (code (+ 1 1) (slurp "foo.txt"))}
Source
function
Usage: (code* & expressions)
Returns a single string containing the pr-str'd representations
of the given expressions.
Source
function
Usage: (combine-responses responses)
Combines the provided seq of response messages into a single response map.
Certain message slots are combined in special ways:
- only the last :ns is retained
- :value is accumulated into an ordered collection
- :status and :session are accumulated into a set
- string values (associated with e.g. :out and :err) are concatenated
Source
function
Usage: (connect & {:keys [port host transport-fn], :or {transport-fn bencode, host localhost}})
Connects to a socket-based REPL at the given host (defaults to localhost) and port,
returning the Transport (by default clojure.tools.nrepl.transport/bencode)
for that connection.
Transports are most easily used with `client`, `client-session`, and
`message`, depending on the semantics desired.
Source
function
Usage: (message client {:keys [id], :as msg, :or {id (uuid)}})
Sends a message via [client] with a fixed message :id added to it.
Returns the head of the client's response seq, filtered to include only
messages related to the message :id that will terminate upon receipt of a
"done" :status.
Source
function
Usage: (new-session client & {:keys [clone]})
Provokes the creation and retention of a new session, optionally as a clone
of an existing retained session, the id of which must be provided as a :clone
kwarg. Returns the new session's id.
Source
function
Usage: (read-response-value {:keys [value], :as msg})
Returns the provided response message, replacing its :value string with
the result of (read)ing it. Returns the message unchanged if the :value
slot is empty or not a string.
Source
function
Usage: (response-seq transport)
(response-seq transport timeout)
Returns a lazy seq of messages received via the given Transport.
Called with no further arguments, will block waiting for each message.
The seq will end only when the underlying Transport is closed (i.e.
returns nil from `recv`) or if a message takes longer than `timeout`
millis to arrive.
Source
function
Usage: (response-values responses)
Given a seq of responses (as from response-seq or returned from any function returned
by client or client-session), returns a seq of values read from :value slots found
therein.
Source
multimethod
No usage documentation available
Connects to an nREPL endpoint identified by the given URL/URI. Valid
examples include:
nrepl://192.168.0.12:7889
telnet://localhost:5000
http://your-app-name.heroku.com/repl
This is a multimethod that dispatches on the scheme of the URI provided
(which can be a string or java.net.URI). By default, implementations for
nrepl (corresponding to using the default bencode transport) and
telnet (using the clojure.tools.nrepl.transport/tty transport) are
registered. Alternative implementations may add support for other schemes,
such as HTTP, HTTPS, JMX, existing message queues, etc.
Source
var
Current version of nREPL, map of :major, :minor, :incremental, and :qualifier.
Source
Public Variables and Functions
function
Usage: (read-bencode input)
Read bencode token from the input stream.
Source
function
Usage: (read-netstring input)
Reads a classic netstring from input—an InputStream. Returns the
contained binary data as byte array.
Source
multimethod
No usage documentation available
Write the given thing to the output stream. “Thing” means here a
string, map, sequence or integer. Alternatively an ByteArray may
be provided whose contents are written as a bytestring. Similar
the contents of a given InputStream are written as a byte string.
Named things (symbols or keywords) are written in the form
'namespace/name'.
Source
function
Usage: (write-netstring output content)
Write the given binary data to the output stream in form of a classic
netstring.
Source
Public Variables and Functions
dynamic var
Function returning the evaluation of its argument.
Source
dynamic var
The message currently being evaluated.
Source
function
Usage: (evaluate bindings {:keys [code ns transport session eval file line column], :as msg})
Evaluates some code within the dynamic context defined by a map of `bindings`,
as per `clojure.core/get-thread-bindings`.
Uses `clojure.main/repl` to drive the evaluation of :code in a second
map argument (either a string or a seq of forms to be evaluated), which may
also optionally specify a :ns (resolved via `find-ns`). The map MUST
contain a Transport implementation in :transport; expression results and errors
will be sent via that Transport.
Returns the dynamic scope that remains after evaluating all expressions
in :code.
It is assumed that `bindings` already contains useful/appropriate entries
for all vars indicated by `clojure.main/with-bindings`.
Source
function
Usage: (interruptible-eval h & configuration)
Evaluation middleware that supports interrupts. Returns a handler that supports
"eval" and "interrupt" :op-erations that delegates to the given handler
otherwise.
Source
function
Usage: (queue-eval session executor f)
Queues the function for the given session.
Source
Public Variables and Functions
dynamic function
Usage: (load-file-code file file-path file-name)
Given the contents of a file, its _source-path-relative_ path,
and its filename, returns a string of code containing a single
expression that, when evaluated, will load those contents with
appropriate filename references and line numbers in metadata, etc.
Note that because a single expression is produced, very large
file loads will fail due to the JVM method size limitation.
In such cases, see `load-large-file-code'`.
Source
function
Usage: (wrap-load-file h)
Middleware that evaluates a file's contents, as per load-file,
but with all data supplied in the sent message (i.e. safe for use
with remote REPL environments).
This middleware depends on the availability of an :op "eval"
middleware below it (such as interruptible-eval).
Source
Public Variables and Functions
function
Usage: (response-for {:keys [session id]} & response-data)
Returns a map containing the :session and :id from the "request" `msg`
as well as all entries specified in `response-data`, which can be one
or more maps (which will be merged), *or* key-value pairs.
(response-for msg :status :done :value "5")
(response-for msg {:status :interrupted})
The :session value in `msg` may be any Clojure reference type (to accommodate
likely implementations of sessions) that has an :id slot in its metadata,
or a string.
Source
macro
Usage: (returning x & body)
Executes `body`, returning `x`.
Source
function
Usage: (uuid)
Returns a new UUID string.
Source
Public Variables and Functions
function
Usage: (handle handler transport)
Handles requests received via [transport] using [handler].
Returns nil when [recv] returns nil for the given transport.
Source
function
Usage: (stop-server {:keys [open-transports server-socket], :as server})
Stops a server started via `start-server`.
Source
function
Usage: (unknown-op {:keys [op transport], :as msg})
Sends an :unknown-op :error for the given message.
Source
Public Variables and Functions
function
Usage: (->FnTransport recv-fn send-fn close)
Positional factory function for class clojure.tools.nrepl.transport.FnTransport.
Source
function
Usage: (->QueueTransport in out)
Positional factory function for class clojure.tools.nrepl.transport.QueueTransport.
Source
function
Usage: (bencode s)
(bencode in out & [s])
Returns a Transport implementation that serializes messages
over the given Socket or InputStream/OutputStream using bencode.
Source
function
Usage: (fn-transport read write)
(fn-transport read write close)
Returns a Transport implementation that delegates its functionality
to the 2 or 3 functions provided.
Source
function
Usage: (piped-transports)
Returns a pair of Transports that read from and write to each other.
Source
function
Usage: (tty s)
(tty in out & [s])
Returns a Transport implementation suitable for serving an nREPL backend
via simple in/out readers, as with a tty or telnet connection.
Source
function
Usage: (tty-greeting transport)
A greeting fn usable with clojure.tools.nrepl.server/start-server,
meant to be used in conjunction with Transports returned by the
`tty` function.
Usually, Clojure-aware client-side tooling would provide this upon connecting
to the server, but telnet et al. isn't that.
Source