This plugin use the OpenAI API, specifically the gpt-3.5-turbo model, to generate documentation for functions in Kotlin and Java based on their source code.
(assuming you already cloned the repo)
- Open this repo in IntelliJ
- Run the Gradle task "Run Plugin". This will open a sandboxes, fresh IntelliJ IDEA instance with the plugin installed
- Run
./gradlew shadowJar
- Use IntelliJ's "Install Plugin from Disk..." option (Setting > Plugins > Settings Cog > Install Plugin from Disk...) to install
ai-generated-docs-intellij-0.0.1-all.jar
in./build/libs
NOTE: It is important you install the JAR whose name has all
in it, as it includes the 3rd party libraries the plugin needs (to e.g. talk to the OpenAI API).
- Set the environment variable
OPENAI_API_KEY
to your OpenAI API Key - Place your cursor caret inside the name of the method you want to document
- Right click, then click "Show Context Actions", followed by "Generate documentation with OpenAI" (this will only show up if a Javadoc comment for your method is not already present)
- Wait, and your documentation will be generated!
- Make sure you are happy sending your source code to OpenAI's server before running this plugin
- If the OpenAI API doesn't respond in the correct format, an error message will be shown in a pop-up, and you'll need to try again.
- Super-long functions - e.g. >1000 lines - will result in a plugin exception due to length limits on the OpenAI API