Fork me on GitHub
#rewrite-clj
<
2022-06-27
>
wilkerlucio14:06:38

hello, I'm trying to use rewrite-clj to analyse some code, I start from clj-kondo analysis info which contains row and col of what I need, how can I navigate to something on rewrite-clj based on row/col?

jacob.maine22:07:37

@wilkerlucio rewrite-clj provides find-last-by-pos which lets you seek to a node if you know its position. There are some caveats to using that function. It only works if you have a :track-position? zipper. And it can be slow, especially if you’re working in large files. See this https://github.com/clj-commons/rewrite-clj/issues/171 for some alternative code that works around both of those problems. Feel free to :thumbsup: that issue if you’d like to see it worked on ;).

wilkerlucio14:06:37

thanks! checking it out