kotlin-language-server icon indicating copy to clipboard operation
kotlin-language-server copied to clipboard

added javadoc support (#1)

Open kievitsp opened this issue 2 years ago • 6 comments

  • added javadoc support

  • added javadoc test case

kievitsp avatar Nov 08 '21 10:11 kievitsp

This is initial implementation of adding the javadoc, and it would be good to get some feedback. For now this works only for functions and only for gradle. It works by adding an additional gradle task to trying to download the sources jar. This is done in a way to facilitate the javadoc jars in the future.

I couldn't find a way to provide the sources jars to the compiler, so i have created a separate service which will index jars and tries find the relevant sources jar on demand. This is synced with the classpath.

Also, I couldn't find a kotlin framework way of rendering out the kdoc, so for now it is building the mark down. The downside is that each different of source element, e.g. function, parameter, class, etc.

However, it would probably be best to get some feedback around the approach, to see if there is a better way of handling this. I have not looked into getting this to work with maven, however, maven does have nicer ways of downloading sources jars automatically.

Also, perhaps the downloading of sources jars in gradle should perhaps be optional?

Any feedback would great, thanks!

kievitsp avatar Nov 08 '21 10:11 kievitsp

Looks pretty cool, I hope to find some time to review it in detail soon, but thanks for the work involved in implementing this already.

If I recall correctly, we have some basic level of support for Javadoc already (#66), but extending this to all declarations (if possible) would of course be great. Regarding the source jars, I think @daplf did some work on fetching them for Maven projects in #292 already.

fwcd avatar Nov 08 '21 10:11 fwcd

Hey. Source jars for maven are already supported as @fwcd mentioned (take a look at the class path resolvers code).

This looks really cool btw. In addition to fixing https://github.com/fwcd/kotlin-language-server/issues/309 (when javadoc is supported on all symbols), this would also fix https://github.com/fwcd/kotlin-language-server/issues/217 (gradle was missing).

daplf avatar Nov 08 '21 12:11 daplf

Sounds good! I wouldn't mind helping out a bit more. It would be quite helpful is the project was formated more along the lines kotlin code standard. There was an issue related to linting #304

I wouldn't mind tackling that, but it would create a rather messy change.

kievitsp avatar Nov 09 '21 15:11 kievitsp

@kievitsp

Also, I couldn't find a kotlin framework way of rendering out the kdoc

Sorry maybe I am misunderstanding but couldn't dokka be used? It can render html pages among other formats and IIRC extends Javadoc https://github.com/Kotlin/dokka

LifeIsStrange avatar Jul 30 '22 01:07 LifeIsStrange

I feel like it is better to have something rather than nothing. I wonder if there is anything I can do to have this PR somehow working 🙂

Dogacel avatar Apr 01 '24 15:04 Dogacel