Another problem is that many people like to use def* macros from external libraries with namespace aliases (enlive/deftemplate, rum/defc). Sometimes you just have to, as in Clojure Spec or Prismatic Schema whose names conflict with clojure.core equivalents.
This PR adds regular expression that treats all forms whose name starts with def (with optional namespace) similarly.
Alternate Designs
The old way (before change) was whitelisting only def macros from clojure.core. It wasn’t working because it will detect standard vars and functions but will fail to detect custom def*-like macros.
Benefits
Detect and highlight more entities from custom def-like macros.
Possible Drawbacks
Mistakenly detect as entity definition a macro which isn’t entity definition but whose name starts with def (highly unlikely)
Applicable Issues
This convention is very well established so it shouldn’t hurt anyone.
Description of the Change
It’s a convention in Clojure to use macros whose name starts with
def
to define something. Libraries often define their own custom macros for this:defroutes
(Compojure)deftemplate
,defsnippet
(Enlive)defc
,defcs
,defcc
(Rum)defnav
,defcollector
,defprotocolpath
(Specter)defproject
(lein)clojure.spec/def
(clojure.spec)schema.core/defn
,schema.core/defrecord
(Prismatic Schema)Another problem is that many people like to use def* macros from external libraries with namespace aliases (
enlive/deftemplate
,rum/defc
). Sometimes you just have to, as in Clojure Spec or Prismatic Schema whose names conflict with clojure.core equivalents.This PR adds regular expression that treats all forms whose name starts with
def
(with optional namespace) similarly.Alternate Designs
The old way (before change) was whitelisting only def macros from clojure.core. It wasn’t working because it will detect standard vars and functions but will fail to detect custom
def*
-like macros.Benefits
Detect and highlight more entities from custom def-like macros.
Possible Drawbacks
Mistakenly detect as entity definition a macro which isn’t entity definition but whose name starts with
def
(highly unlikely)Applicable Issues
This convention is very well established so it shouldn’t hurt anyone.