This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-29
Channels
- # architecture (3)
- # aws-lambda (1)
- # babashka (7)
- # beginners (60)
- # calva (33)
- # chlorine-clover (8)
- # cider (24)
- # circleci (4)
- # clj-kondo (13)
- # cljs-dev (1)
- # cljsrn (12)
- # clojure (76)
- # clojure-australia (6)
- # clojure-europe (100)
- # clojure-france (1)
- # clojure-nl (13)
- # clojure-uk (16)
- # clojurescript (49)
- # conjure (1)
- # cryogen (8)
- # datomic (43)
- # dirac (3)
- # etaoin (1)
- # exercism (4)
- # fulcro (32)
- # jobs (2)
- # kaocha (4)
- # nginx (1)
- # off-topic (106)
- # pathom (8)
- # reagent (5)
- # reitit (5)
- # sci (52)
- # shadow-cljs (37)
- # tools-deps (30)
- # tree-sitter (18)
- # xtdb (18)
here is the corresponding highlights.scm: https://gist.github.com/sogaiu/a2a51cd58e5276a4676f3195897bf7c9
highlights.scm has definitions for highlighting the following:
* keywords
* strings
* numbers
* booleans and nil
* comments
* discard expressions
* the ^
for metadata
* dynamic variables (ear-muffed things)
* symbols starting with &
(like &form
, &env
, &
)
* gensym-ish things (symbols ending with #
)
* some macro calls (just the head)
* some built-in function calls (just the head)
* other function calls (just the head)
* some interop-ish things (i.e. symbol in head position that starts with .
)
* symbols that contain dots (e.g. clojure.lang.Numbers
)
* things that are quoted or syntax quoted may have their highlighting affected
thanks for taking a look! yes, you are right that there are no discards in the image. such sharp eyes! sorry about that. i think the image may be missing gensym stuff and possibly other stuff too. i'll make a few more images 🙂
this is what discard expressions look like if you give them the highest priority (i.e. you put a rule for it at the top of the highlights.scm file)
i don't really find that to my taste, so i tend to go for the following sort of arrangement
the following demos gensym-ish symbol highlighting along with syntax-quoted forms having somewhat different coloring
in the very first image, if you look closely, you may be able to see that there is actually a difference between macro calls (boldish pinkish) and "built-in" functions (e.g. cast
is not bold and is sort of redish)
i think the bold light blue in the first image is roughly non-built-in calls -- where "non-built-in" basically means highlights.scm hasn't been taught about such symbols. the point is to be able to distinguish between: * macro / special form calls (only the known ones) * built-in function calls (only the known ones) * other calls
I wasn’t referring to the image really. It was the gist. But I only read it very quickly. (Super happy with having some images to look at for more examples, though).
here is the line in the gist regarding discard expressions: https://gist.github.com/sogaiu/a2a51cd58e5276a4676f3195897bf7c9#file-highlights-scm-L11
i made an attempt at getting things to work with nvim-treesitter: https://github.com/sogaiu/nvim-treesitter/tree/clojure