This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-28
Channels
- # beginners (2)
- # calva (8)
- # capetown (1)
- # clojure (28)
- # clojure-europe (6)
- # clojure-norway (82)
- # clojure-sweden (1)
- # clojuredesign-podcast (5)
- # clojurescript (26)
- # core-async (3)
- # cryogen (7)
- # datahike (30)
- # datomic (10)
- # figwheel-main (8)
- # honeysql (8)
- # hyperfiddle (15)
- # jobs-discuss (6)
- # lsp (6)
- # matrix (6)
- # off-topic (12)
- # overtone (1)
- # polylith (6)
- # portal (6)
- # releases (1)
- # shadow-cljs (9)
- # sql (1)
- # xtdb (5)
Suppose I want any comment
form to have special background-highlight to distinguish it from code not inside comment
form. Simple way to do this?
Motivation: Sometimes I am navigating a file from bottom to top and I run across a form that I start to pay attention to, only to realize it's inside (comment ...)
and therefore something I have as a "reference" but not a function "active" in my project. (It's a cognitive "distraction".)
It’s already italics, but that’s obviously to subtle. 😃 You can change it via the setting calva.highlight.commentFormStyle
, see also https://calva.io/syntax-highlighting/#extra-highlighting.
I use Joyride for this and it’s awesome: I have a Joyride script:
(defn set-comment-opacity [val]
(.update (.getConfiguration vscode/workspace)
"calva.highlight.commentFormStyle"
#js {:fontStyle "italic"
:opacity val}
true))
(defn toggle-comment-opacity []
(let [path "calva.highlight.commentFormStyle"
current-opacity (.-opacity (.getConfiguration vscode/workspace path))]
(js/console.log current-opacity)
(if (= current-opacity "0.3")
(set-comment-opacity "1")
(set-comment-opacity "0.3"))))
and then I do something like this in my keyboard shortcuts:
{
"key": "ctrl+alt+cmd+c",
"command": "joyride.runCode",
"args": "(user-scripts/toggle-comment-opacity)"
},
I have the exact same problem, comments throughout file, makes it hard to scan for what’s revlevant
nice, didn’t see the fiddle file thing before, will consider moving some stuff to it. The folding would be nice but seemed a bit more involved than just toggling the opacity, which works well for me