Inspiration
In every software development environment, it is crucial not only to provide great code but also to write comprehensive comments so that everyone involved can understand your code. However, writing such comments can be a chore, and many files are inadequately commented. Wouldn't it be great if there were a plugin that generates comments for you? Not just for some lines, but for all of them, considering the entire context of your program and formatting them nicely?
Implementation
We utilized the Plugin template provided by JetBrains and built a new icon in the Toolwindow. With a single click, you can generate documentation. After that, you receive a copy of your current file with all the comments and can still make changes, and if you think it's fine, you can overwrite the original file with one click. The comments are generated by ChatGPT, and the link between your IDE and ChatGPT is the OpenAI API. Therefore, you need an API key to use our plugin.
Challenges
Firstly, we had to understand how to use the OpenAI API and the Plugin template. With limited tutorials and mostly relying on official documentation, we invested considerable effort to quickly grasp the functionalities. Then, we encountered the challenge that things in the Toolwindow can't simply retrieve data from the open file, so we had to develop workarounds ourselves. After successfully overcoming this, we programmed a JSON parser and an automated formatter to ensure the output of ChatGPT is automatically formatted. However, there remains an issue with ChatGPT not providing deterministic results. Although we made efforts to circumvent it, due to the architecture of this LLM, 100% certainty is not possible.
Use cases
Imagine standing in front of a large and complex file with obscure methods that would take a lot of time and effort to fully understand. Generating a codebook with our plugin will aid you in this process and significantly lower the entrance hurdle for newcomers. A second use case is when you don't have the time or inclination to comment your code adequately. Our plugin will handle most of the work for you; you just need to proofread.
Built With
- docker
- doxygen
- gitlab
- intellij-idea
- java
- latex
Log in or sign up for Devpost to join the conversation.