Releases: tonsky/Clojure-Sublimed
3.8.0
3.7.3
3.7.2
3.7.1
3.7.0
- Added
output.repl
panel for raw nREPL output #104 - Added
Toggle Output Panel
command for raw nREPL connections #104 - Fixed
Reconnect
command - Added optional
on_finish
argument tocs_conn.eval
- Added
print_quota
as a setting and as an argument tocs_conn.eval
- New feature: Watches!
Watches
Watches are great alternative to debug prints: they allow you to monitor intermediate values during function execution right in the editor.
This is how they work:
- Select a right-hand expression
- Run
Clojure Sublimed: Add Watch
command - Now every time function is executed, for any reason, watched expressions will display values they evaluate to, in real time.
Watches are only supported in Socket REPL.
3.6.0
Socket REPL: fixed escaping in clojure_sublimed_eval_code
Display failed tests report as red
It was a bit confusing before when evaluation succeeded (normal value is reported, no exception has been thrown) so result was displayed as green, but in fact some tests still might have failed.
Clojure Sublimed now recognizes :fail
and :error
keys in result and if they are positive, displays results as red:
Add transform
argument to clojure_sublimed_eval
Clojure Sublimed now allows you to create custom commands that transform code before sending it to eval.
For example, this will pretty-print result of your evaluation to stdout:
{"keys": ["ctrl+p"],
"command": "clojure_sublimed_eval",
"args": {"transform": "(doto %code clojure.pprint/pprint)"}}
transform
is a format string that takes selected form, formats it according to described rules and then sends resulting code to evaluation.
If you now press ctrl+p
on a form like (+ 1 2)
, the actual eval sent to REPL will be:
(doto (+ 1 2) clojure.pprint/pprint)
Which will pretty-print evaluation result to stdout. This pattern might be useful for large results that don’t fit inline.
Another use-case might be “eval to buffer”:
{"keys": ["ctrl+b"],
"command": "chain",
"args": {
"commands": [
["clojure_sublimed_eval", {"transform": "(with-open [w (clojure.java.io/writer \"/tmp/sublimed_output.edn\")] (doto %code (clojure.pprint/pprint w)))"}],
["open_file", {"file": "/tmp/sublimed_output.edn"}]
]
}
}
Eval to buffer at work:
Inside transform
you can also use %ns
(current ns) and %symbol
(if selected form is def
-something, it will be replaced with defined name, otherwise nil
).
This allows us to implement “run test under cursor”:
{"keys": ["super+shift+t"],
"command": "clojure_sublimed_eval",
"args": {"transform": "(clojure.test/run-test-var #'%symbol)"}}
Run test under cursor at work:
Enjoy!