Fork me on GitHub
#clj-kondo
<
2022-02-17
>
Akiz16:02:22

Hi, I am using clj-kondo/analysis and I would like to see the specific part of analysed source code. Let’s say there is (-> analysis :var-definition first) which returns

{:filename "/tmp/foo.clj",
                    :row 8,
                    :col 1,
                    :end-row 9,
                    :end-col 11,
                    :ns foo,
                    :name f,
                    :defined-by 'clojure.core/defn-
                    :private true,
                    :fixed-arities #{1}}
What would be the way to get the source code of this definition?

borkdude16:02:20

@zikajk Probably read /tmp/foo.clj at line 8 until line 9 and cut out the right columns

borkdude16:02:02

probably just the lines will be enough for var defs

Akiz16:02:44

@borkdude Cool, this works for me. I wanted to be sure that i dont reinvent wheel. thanks again.

👍 2