Hello, I came across an old <post> that talks abou...
# dokka
a
Hello, I came across an old post that talks about simplifying the use of the Kotlin Analysis API. Is this API still provided by Dokka? It seems like it might have been moved to analysis-kotlin-symbols, but everything there appears to be internalized.
o
Hey! Well, thanks for the post! But I would say, that's it not how Dokka should be used 🙂 And as you've already seen, it's internal now and will stay like this The fact, that Dokka was exposing compiler APIs (descriptors in case of post) was more of a bug than a feature... Coming back to analyzing kotlin code. Currently, there is no fully stable way to do it, but there is an ongoing work to create stable Kotlin Analysis API. It's currently used by Dokka and KSP2 (at least those are known to me). The same API is also used in IDEA Kotlin K2 plugin. And, the API is rather high-level, and if you will take a look on
analysis-kotlin-symbols
it's mostly maps models Preview documentation can be found here, though it's not that easy to depend on it now because it's published only in separate repository and requires a bit of Gradle magic to work (you can take a look on Dokka and KSP Gradle setup) Though, it's still not stable, and there could be some bugs In the end, Dokka is just a Kotlin documentation tool 🙂 Hope this answers your question. BTW, just curious, what you want to achieve in the end ?
a
I was honestly surprised to find that a documentation tool/plugin would provide an abstraction over the analysis API in the first place, so this makes much more sense now. I had been trying to build a language server for Kotlin using the said API, but I couldn't find proper documentation on adding new sources to the existing analysis session without requiring a rebuild, and especially around incremental parsing and analysis, so I was wondering if Dokka's abstraction would cover or simplify those aspects for me. Thank you for the detailed response!
o
Probably Dokka will not help here, as we don't need incremental analysis there You might be interested in this: https://github.com/fwcd/kotlin-analysis-server though, I just know it exists, and it uses AA 🙂
a
I've gone through the entire GitHub looking for usage examples, and it seems like the source codes for KSP and Dokka are also great starting points for understanding the AA. 🙂
👍 1