Fork me on GitHub

I don't know if this is a Cursive issue or not but on the latest IntelliJ IDEA the small menu on the bottom of the IDE from which you can choose to use parinfer or paredit has disappeared. Any idea if it can be restored there somehow?


In the REPL, if I have softwrap on on input, I can’t move the cursor using keyboard arrow keys beyond the current line’s beginning. Is this intentional?


Hi. I'm interested to know how you are doing your test workflow. Like tools you're using, how you run/re-run tests, (and how you reload chnages). Are you using terminal or running in repl integrated with editor? Thanks for sharing


My workflow right now is using the cursive test integration ( Basically I created shortcut to run/rerun the tests. To reload the changes from multiple namespace, I use the cursive "sync files in repl". If that does not seem to work I reload namespace using ( with mount to reset the state. I created a helper method in dev.clj called reset, and created a repl command to assign a keyboard shortcut.

(defn reset []
  (toolnamespace/refresh :after 'dev/go))
Things that I don't like about the workflow: 1. If have to go to the test file in order to see the test results information 2. I have inconsistent way of reloading the state (sometimes "sync files" or "reset" the state). I wonder if above can be solved by (will try them soon): 1. Just run the test in terminal 2. Just run reset everytime before I run test (I wonder if it works). In cursive/intellij, you can configure that I believe I've read somewhere also about using rich comment where you write production and test code in comment (in the same namespace), then once you're done writing them, you cut and paste test code to the test namespace. I'm curious to know how that works for you guys.


I'm just pressing Cmd-R from either the file of the implementation or the test namespace and that syncs the changed files 1st before rerunning the latest tests. I don't think I had to do any customization for this; that's how it works out of the box. To run a test for the 1st time, I haven't bothered to create any shortcuts. I simply press Cmd-Shift-A to evoke the Actions popup, then type "run te". That will bring the 2 actions for running either individual test or all tests to the top of the popup.


u must be in a test namespace and a repl must be in focus for the project u r editing, otherwise u wont see these menu items


to see the test failures, i often just press F2 to show the 1st failure around the caret. unfortunately it moves the cursor away from the point of editing and the popup explaining the error is not very readable. sometimes that popup have a blue link to show diffs between the actual and expected results, but currently there is no keyboard shortcut which would activate the dialog that link leads to.


im also using expectations.clojure.test so i can write (expect <expected> <actual>) instead of (is (= <expected> <actual>)). in this case, the error failure contains (=? ... which cursive doesn't understand and doesn't even show the Show diff... link.


example error msg:

Expected: (=? #{:with-update-and-merchantx} (-> txn-descr-merchant-by-human-q (d/q db [:txn.descr/str "txn-descr"]) (idents db)))
Actual: (not (=? #{:with-update-and-merchantx} #{:with-update-and-merchant}))


if im dealing with bigger data structures in my tests, i just fire up kaocha in the built-in terminal, OR kaocha actually has some REPL integration, so u can just run specific tests or test specific namespaces with a function call. such a function call i just type up in the cursive repl window's input area directly, then i use my custom F12 shortcut to repeatedly execute the last expression in the REPL but first sync the current file im editing.


for that you have to create a new REPL command with the Add New REPL Command action, like on this screenshot


and then assign it to a keyboard shortcut (like F12) within the keymap. you will find this REPL action there by the name u assigned to it (like Re-execute last command in this example)


For your shortcut cmd+r , what is the name of the command in the keymap? Pressing cmd+r on mine restarts the repl.


"to see the test failures, i often just press F2 to show the 1st failure around the caret." Just to confirm, this will only work if your editor is focused in the test file where the error is right? Meaning if I moved to a different file and pressing f2 , then it won't go to the test file where the error is? (that is the case in my machine)


Btw, there is a command "Error Description" where it will also show the tooltip of test error. Your cursor needs to be in the highlighted error though.