Closed scotts777 closed 1 year ago
Hi @scotts777,
It is technically possible, however I wouldn't say it is worth the pain of adding it. There are several reasons I say this:
def
, defonce
, defn
, defn-
, defmacro
, defmulti
, defprotocol
, defrecord
, defstruct
, deftype
and definline
. Some of these have different rules for where doc-strings appear.The regular expressions to make it work would be very complex and difficult to write/maintain. Just differentiating between these two things with regular expressions, is far more difficult than you would initially think:
(def foo
"regular string")
(def bar
"doc-string"
nil)
defrule
in Clara rules. I have no idea how this could be accomplished.As far as I'm aware, for these reasons (and maybe others), no other editor supports this. However, you can of course add the syntax highlight rules for it to your personal Vim config overriding our defaults. Unfortunately I'm not entirely sure how you would go about writing those syntax rules.
Yes, that makes good sense.
Was wondering if it is possible to target the doc strings that are in a defn form separately from normal Strings?
(defn my-function "This is the doc string I am talking about. It would be great if this can be highlighted differently from regular Strings" [arg 1 arg2] ...
I probably need a syntax region, but I am lost with the syntax file format. Thanks