This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-11
Channels
- # ai (2)
- # announcements (5)
- # babashka (16)
- # beginners (24)
- # calva (22)
- # clerk (2)
- # clj-yaml (4)
- # cljsrn (1)
- # clojure (15)
- # clojure-dev (7)
- # data-science (5)
- # datalevin (1)
- # emacs (21)
- # events (1)
- # hyperfiddle (33)
- # lsp (71)
- # membrane (1)
- # podcasts-discuss (1)
- # practicalli (11)
- # re-frame (17)
- # reagent (3)
- # sci (1)
- # shadow-cljs (47)
- # transit (1)
Good morning all! Does anybody know why I'm getting this indentation? Using clojure-mode, paredit rainbow delimiters.
If you can share the code then we can try replicate. Seems unusual indentation to me though.
(defn render-due-tasks []
(let [tasks (r/atom {:error nil :items []})
fields (r/atom {:color "" :task_id #{}})
pagename (.-value (.getElementById js/document "pagename"))]
(update-tasks tasks pagename)
(fn []
;; when it re-paints, we need to reset the checkboxes
(swap! fields #(assoc % :task_id #{}))
[:div
[:table
[:colgroup
[:col {:style {:width "2em"}}]
[:col {:style {:width "100%"}}]]
[:tbody
(for [task (:items @tasks)]
^{:key task}
[:tr (when
(:highlight task)
{:style {:background-color (:highlight task)}})
[:td [:input {:type "checkbox"
:name "task_id"
:value (:task_id task)
:on-change #(toggle-checkbox fields %)}]]
[:td (:task_name task)]])]]
[:p {:style {:color "red"}} (:error @tasks)]
;; delete button
[:button {:on-click #(delete-tasks fields tasks pagename)} "delete"] " "
;; highlight button
[:select {:name "color"
:on-change #(handle-highlight fields % tasks pagename)}
[:option {:value nil} "highlight"]
(for [color (keys shared/colormap)]
^{:key color} [:option {:value color} color])]
;; defer button
[:select {:name "defer" :on-change ()}
[:option {:value nil} "defer"]
]
])))
Curious. When I format the above code with cider-format-buffer
(with the REPL started) then I get what I consider the correct indentation
[:tr (when
(:highlight task)
{:style {:background-color (:highlight task)}})
However, RTN
after the when
form positions the cursor further indented, exactly as your example
To me this suggests either lsp (cljfmt) or clojure-mode is causing the different indentation (although I dont know why that would be the case)
Personally I'd move the when condition to the same line and try forget about the unusual indent
(when (:highlight task)
,,,)
yep I guess that's nicer
whenever you get a unusual indent, it can be considered clojure-mode's way of telling you that the newline placement wasn't that idiomatic
@U45T93RA6 Is that a specific feature of clojure-mode (I couldnt find any docs) or a consequence of clojure-mode not having an applicable rule to apply? Or perhaps a general tip from experience? Thanks.
Has anyone played around with elpaca? https://github.com/progfolio/elpaca
Hi, does anyone know why I don’t get Clojure documentation with Corfu (popupinfo)? I am running Eglot and Cider…
@U043RSZ25HQ What do you mean? I am calling corfu-info-documentation which returns “No documentation available for …“.
Ah, that’s just an example, it doesn’t work anywhere. (however, C-c C-d d works over snippets, so I wouldn’t mind if Corfu could do it too)
@U043RSZ25HQ If it works for you, could you share your configuration 🙏?
I don't use eglot but my doom config is here: https://github.com/elken/doom
@UBRV1HXPD It's possible we haven't implemented something required in CIDER. This doc integration had a special API in Company mode, not sure how the situation looks in Corfu.
@U051BLM8F To be honest, I don't care about Cider much. I'd prefer it to work with clojure-lsp and eglot. That is, to have documentation even when the repl isn't running.
Fair enough. I can't comment on the integration between elgot and corfu, though, as I've never used them.