This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-22
Channels
- # anglican (2)
- # announcements (8)
- # babashka (37)
- # beginners (13)
- # calva (16)
- # clj-kondo (20)
- # cljdoc (1)
- # cljsrn (3)
- # clojure (6)
- # clojure-europe (3)
- # clojurescript (3)
- # clojureverse-ops (3)
- # conjure (1)
- # core-async (9)
- # cursive (6)
- # cypress (2)
- # datomic (5)
- # fulcro (1)
- # honeysql (15)
- # luminus (2)
- # malli (35)
- # music (3)
- # nbb (1)
- # off-topic (7)
- # pathom (12)
- # practicalli (1)
- # re-frame (15)
- # reagent (37)
- # sci (9)
- # shadow-cljs (3)
- # show-and-tell (3)
- # spacemacs (3)
- # workspaces (3)
Hi, I have a problem formatting this code block (taken from @yogthos' book):
(defn create-user!
[login password]
(jdbc/with-transaction [t-conn db/*db*]
(if-not (empty? (db/get-user-for-auth* t-conn {:login login}))
(throw (ex-info "User already exists!"
{:pietrail/error-id ::duplicate-user
:error "User already exists!"}))
(db/create-user!* t-conn
{:login login
:password (hashers/derive password)}))))
When I press TAB, this message appears:
Running the contributed command: 'calva-fmt.formatCurrentForm' failed.
This happens when I use this additional formatting option:
{:align-associative? true}
Once I switch this option to false, no problem (but it doesn't format the way I would like to).
Is this a calva issue, or a cljfmt issue?Yes, I recommend not using the setting, and instead doing it on demand, with the separate command, which is named something like Format and Align Current Form. Default shortcut is ctrl+alt+l
. Though I have to also warn that we are considering removing the feature fully. It is causing confusion and troubles. I am figuring if I can support it on-demand somehow anyway, without having it as an option for the formatter.
Somehow, after being a longtime vscode user, I just found out about https://code.visualstudio.com/blogs/2018/07/12/introducing-logpoints-and-auto-attach! It’d be great to have support built into calva, especially if forms, rather than lines, could be instrumented. Might also be an interesting usecase for tap?
Indeed. I am a heavy user of logpoints whe coding in TypeScript. Not sure how hard it would be to add it to Calva, but please file a feature request about it.
Probably built-in if using DAP (Debugger adapter protocol), but AFAIK Calva use cider debugger which doesn't follow that protocol, not sure it's possible without that, maybe there is a way somehow
@UKFSJSM38 Calva's debugger uses the DAP, we just use cider-nrepl in conjunction with it. Did you mean some specific way of using the protocol or a specific feature?
Oh, I didn't know it was following DAP, what is the DAP server you use as a DAP client?
I mean, it's similar to LSP, there is a client and a server, the server is where the logic of breakpoints, threads etc and just tell the client how to behave
The vscode api provides a DebugAdapterServer
class which we instantiate here: https://github.com/BetterThanTomorrow/calva/blob/1f4cf27b45afbb785d51511ea48683d416da7a42/src/debugger/calva-debug.ts#L319