Middleware descriptors and related utility functions.
While normally middleware descriptors live alongside middleware definitions, cider-nrepl separates those. The rationale behind this is to avoid loading each middleware definition until its first usage. For this purpose we're defining each middleware as a wrapper that defers the loading of the actual middleware.
Middleware descriptors and related utility functions. While normally middleware descriptors live alongside middleware definitions, cider-nrepl separates those. The rationale behind this is to avoid loading each middleware definition until its first usage. For this purpose we're defining each middleware as a wrapper that defers the loading of the actual middleware.
(def-wrapper name handler-fn & [trigger-it descriptor])
Define delayed middleware (e.g. wrap-xyz).
handler-fn
is an unquoted name of a function that takes two arguments -
handler
and message
. It is called only when certain conditions are met as
expressed by the optional trigger-it
argument. trigger-it
can be either a
function or a set of ops (strings). When a function, it must take a msg
and
return truthy value when handler-fn
should run. When trigger-it
is missing,
handle-fn
is called when :op of msg
is one of keys of the :handles slot of
the descriptor
. When trigger-it
is a set it should contain extra ops,
besides those in :handles slot, on which handle-fn
is
triggered. descriptor
is passed directly to the nREPLs set-descriptor!
.
Define delayed middleware (e.g. wrap-xyz). `handler-fn` is an unquoted name of a function that takes two arguments - `handler` and `message`. It is called only when certain conditions are met as expressed by the optional `trigger-it` argument. `trigger-it` can be either a function or a set of ops (strings). When a function, it must take a `msg` and return truthy value when `handler-fn` should run. When `trigger-it` is missing, `handle-fn` is called when :op of `msg` is one of keys of the :handles slot of the `descriptor`. When `trigger-it` is a set it should contain extra ops, besides those in :handles slot, on which `handle-fn` is triggered. `descriptor` is passed directly to the nREPLs `set-descriptor!`.
Map of delay
s holding deferred middleware handlers.
Map of `delay`s holding deferred middleware handlers.
The minimum Clojure version needed by cider-nrepl to work properly. Having an enforced minimum version can help users and maintainers alike diagnose issues more quickly, avoiding problematic code paths in our middleware, and in clients like cider.el.
The minimum Clojure version needed by cider-nrepl to work properly. Having an enforced minimum version can help users and maintainers alike diagnose issues more quickly, avoiding problematic code paths in our middleware, and in clients like cider.el.
Set of nREPL ops that can lead to code being evaluated.
Set of nREPL ops that can lead to code being evaluated.
Lock used to inhibit concurrent require
of the middleware namespaces.
Clojure seem to have issues with concurrent loading of transitive
dependencies. The issue is extremely hard to reproduce. For the context see
https://github.com/clojure-emacs/cider/issues/2092 and
https://github.com/clojure-emacs/cider/pull/2078.
Lock used to inhibit concurrent `require` of the middleware namespaces. Clojure seem to have issues with concurrent loading of transitive dependencies. The issue is extremely hard to reproduce. For the context see https://github.com/clojure-emacs/cider/issues/2092 and https://github.com/clojure-emacs/cider/pull/2078.
(run-deferred-handler fn-name handler msg)
Require and invoke the handler delay at run-time with arguments handler
and msg
.
fn-name
must be a namespaced symbol (unquoted).
Require and invoke the handler delay at run-time with arguments `handler` and `msg`. `fn-name` must be a namespaced symbol (unquoted).
(warmup-orchard-caches!)
Warms up orchard.java/cache
, drastically improving the completion and info UX performance for first hits.
(This was our behavior for many years,
then had to be disabled for test suite reasons in Orchard 0.15.0 to 0.17.0 / cider-nrepl 0.38.0 to 0.41.0, and now it's restored again)
Note that this can only be done cider-nrepl side, unlike before when it was done in Orchard itself.
Warms up `orchard.java/cache`, drastically improving the completion and info UX performance for first hits. (This was our behavior for many years, then had to be disabled for test suite reasons in Orchard 0.15.0 to 0.17.0 / cider-nrepl 0.38.0 to 0.41.0, and now it's restored again) Note that this can only be done cider-nrepl side, unlike before when it was done in Orchard itself.
(wrap-apropos h)
Middleware that handles apropos requests
Middleware that handles apropos requests
(wrap-classpath h)
Middleware that provides the java classpath.
Middleware that provides the java classpath.
(wrap-clojuredocs h)
Middleware to find a documents from ClojureDocs.
Middleware to find a documents from ClojureDocs.
(wrap-complete h)
Middleware providing completion support.
Middleware providing completion support.
(wrap-content-type h)
Middleware that adds content-type
annotations to the result of the the eval op.
Middleware that adds `content-type` annotations to the result of the the eval op.
(wrap-debug h)
Provide instrumentation and debugging functionality.
Provide instrumentation and debugging functionality.
(wrap-format h)
Middleware providing support for formatting Clojure code and EDN data.
Middleware providing support for formatting Clojure code and EDN data.
(wrap-inspect h)
Add a value inspector option to the eval op. Passing a non-nil value
in the :inspect
slot will cause the last value returned by eval to
be inspected. Returns a string representation of the resulting
inspector's state in the :value
slot.
Add a value inspector option to the eval op. Passing a non-nil value in the `:inspect` slot will cause the last value returned by eval to be inspected. Returns a string representation of the resulting inspector's state in the `:value` slot.
(wrap-log h)
Middleware that captures log events and makes them inspect-able.
Middleware that captures log events and makes them inspect-able.
(wrap-macroexpand h)
Macroexpansion middleware.
Macroexpansion middleware.
(wrap-ns h)
Provide ns listing and browsing functionality.
Provide ns listing and browsing functionality.
(wrap-profile h)
Middleware that provides supports Profiling based on https://github.com/thunknyc/profile
Middleware that provides supports Profiling based on https://github.com/thunknyc/profile
(wrap-resource h)
Middleware that provides the path to resource.
Middleware that provides the path to resource.
(wrap-slurp h)
Middleware that handles slurp requests.
Middleware that handles slurp requests.
(wrap-spec h)
Middleware that provides clojure.spec
browsing functionality.
Middleware that provides `clojure.spec` browsing functionality.
(wrap-stacktrace h)
Middleware that handles stacktrace requests, sending cause and stack frame info for the most recent exception.
Middleware that handles stacktrace requests, sending cause and stack frame info for the most recent exception.
(wrap-test h)
Middleware that handles testing requests.
Middleware that handles testing requests.
(wrap-trace h)
Toggle tracing of a given var.
Toggle tracing of a given var.
(wrap-tracker h)
Under its normal operation mode, enhances the eval
op by notifying the client of the current REPL state.
You can also request to compute the info directly by requesting the "cider/get-state" op.
Under its normal operation mode, enhances the `eval` op by notifying the client of the current REPL state. You can also request to compute the info directly by requesting the "cider/get-state" op.
(wrap-undef h)
Middleware to undefine a symbol in a namespace.
Middleware to undefine a symbol in a namespace.
(wrap-version h)
Provides CIDER-nREPL version information.
Provides CIDER-nREPL version information.
(wrap-xref h)
Middleware that provides find references functionality.
Middleware that provides find references functionality.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close