This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-28
Channels
- # announcements (2)
- # babashka (21)
- # beginners (24)
- # calva (9)
- # cider (7)
- # clj-kondo (12)
- # clojure (116)
- # clojure-europe (5)
- # clojure-korea (2)
- # clojure-norway (3)
- # clojure-poland (1)
- # clojure-spec (5)
- # clojurescript (12)
- # cursive (12)
- # datomic (8)
- # google-cloud (4)
- # honeysql (16)
- # java (18)
- # lsp (10)
- # missionary (14)
- # polylith (12)
- # re-frame (13)
- # releases (4)
- # shadow-cljs (10)
- # sql (10)
- # testify (2)
Does anyone know the cause of the following behavior? We have a macro api/defendpoint
that wraps around compojure and offers some nice amenities. Sometimes when my cursor is in the form everything behaves as normal. Sometimes the entire form is highlighted, and navigation just goes to the top of the form. Screenshots in 🧵
Here the entirety of the form is highlighted. Navigation just goes to the top of the current form
That macro is configed with :macroexpand
in .clj-kondo/config.edn
and the definition of it’s expansion is
(defmacro defendpoint
"Macro for api.common/defendpoint*"
[method route & body]
(let [method-fn (symbol "compojure.core" (str method))
route-name (route-fn-name method route)]
`(do
~method-fn ;; register usaged
(defn ~route-name ~@body))))
I had the same on nubank/state-flow macros, but there is a way to fix that that we Implemented on clj-kondo to support those cases
Ah it was not state-flow, it was another internal macro, but I can share the hook code:
(ns nubank.common-graphql.lacinia.sweet
(:require [clj-kondo.hooks-api :as hooks]))
(defn defresolver
"Expands to: `(def my-resolver (do ...))`"
[{:keys [node]}]
(let [[{name-kw :k} & tail] (rest (:children node))]
{:node (with-meta
(hooks/list-node
[(hooks/token-node 'def)
(with-meta (symbol (str (namespace name-kw)
"-"
(name name-kw)))
(meta name-kw))
(hooks/list-node
(concat [(hooks/token-node 'do)]
tail))])
(meta node))
:defined-by 'common-graphql.lacinia.sweet/defresolver}))