注目イベント!
アドベントカレンダー2024開催します(12/1~12/25)!
一年を締めくくる特別なイベント、アドベントカレンダーを今年も開催します!
初心者からベテランまで楽しめる内容で、毎日新しい技術トピックをお届けします。
詳細はこちらから!
event banner

Introducing JetBrains' AI Assistant Feature to Enhance Developer Experience (DX)

| 7 min read
Author: noboru-kudo noboru-kudoの画像
Information

To reach a broader audience, this article has been translated from Japanese.
You can find the original version here.

Recently, JetBrains announced the general availability of its AI Assistant feature.

In this article, I tried out this feature and would like to introduce how it can be used. For this article, I am using IntelliJ IDEA 2023.3 (Ultimate Edition) as the IDE.

The official documentation for the AI Assistant feature is available here.

What is JetBrains' AI Assistant?

#

It's a feature of JetBrains AI that combines JetBrains' IDE expertise with LLM to streamline the development workflow. It does various things including refactoring, code generation, documentation creation, and detecting issues in the source code. A similar service would be GitHub Copilot.

Currently, most AI features use OpenAI, but plans are in place to support JetBrains custom models and others like Google in the future. Below is a quote from the official page.

There is also an ongoing track with other providers (e.g. Google and others) regarding their models. Still, for the majority of use cases, OpenAI is our current LLM provider.
For the on-premises scenario, we will serve the provider included in the cloud platform (AWS Anthropic, Google PaLm 2, or Azure OpenAI).

A subscription-style license purchase is required separately from the IDE.
Currently, it costs about 13,000 yen per year for individuals.

Of course, it is also possible to purchase through Samuraism, the general agent in Japan.

Product Code Generation

#

As for how to use AI, it is probably the quintessential function.
When you input a description of the code you want to generate into the prompt, the AI Assistant generates the code for you.

It shows the differences, making it easy to see how it changes. If you don't like it, you can give additional instructions with "Specify." "Accept All" incorporates the code generated by AI.

Refactoring Suggestions

#

It suggests refactoring for the specified range of source code.

Like before, the proposed code is shown in differences, which is convenient for deciding whether to incorporate it. This is where you can feel JetBrains' expertise.

Problem Detection

#

It checks if there are any problems within the specified range of source code.

Not only does it detect problems, but you can also ask for improvement methods via chat, which is convenient.
It seems like you could leave the source code level review to the AI Assistant.

Information

Here, I was able to change the AI Assistant's response to Japanese in the settings.
"Settings" -> "Tools" -> "AI Assistant" -> "User Prompts Library" -> "Find Problems" to add instructions to the prompt.

Test Code Generation

#

Generating test code has probably become a familiar feature with AI code generation.
It analyzes the content of the product code and generates appropriate test codes.

Once created, you can improve it further by adding instructions to suit your preferences. Instructions for the testing framework or library to use can also be done from "Specify" (it seems likely that you will be able to specify these in advance in the future).

Source Code Summary

#

This seems quite useful. It summarizes any given source code.

It's something you'd want to run once when reading legacy codes or OSS that might break your spirit. If you have questions about a particular part, you can deepen your understanding of the code through chat.

Commit Comment Generation

#

This is subtly useful. AI proposes appropriate commit comments based on the changes.

It summarizes the changes, so it helps you reflect on what changes you made when committing[1].
Currently, it is not possible to customize the prompt to generate comments in Japanese.

Variable Name Suggestions

#

This is also subtly useful. AI understands the context of the code and proposes appropriate variable name candidates.

As someone who struggles with English, I always have trouble with naming, so this is very helpful.
Currently, it only suggests names in an in-place format, and for some reason, it does not propose during dialog-style name changes. I'm looking forward to future updates.

Document Generation

#

This is also very convenient. I always find it tedious to write, but AI summarizes the target source code and creates the document.

Getting used to this might lead to a habit of slacking off, but if you always run it when making changes, you can prevent the documentation from being left unmaintained.

Custom Prompts

#

So far, we have used the standard features of the AI Assistant, but you can also create custom prompts.

Here, I created a custom prompt for blog articles.
You can specify custom prompts from "Settings" -> "Tools" -> "AI Assistant" -> "User Prompts Library".
I created a prompt named "Check Blog" that suggests proofreading and titles for blog articles as follows.

I embedded the selected content with $SELECTION.

When I tried this with a previous article, it turned out like this.

Normally, I check the text with textlint, but using this allows for a deeper check.
I always struggle with article titles, but it also suggests slightly exaggerated titles, which is a new discovery.

Summary

#

Although I can't say I have fully mastered it yet, I have tried the main features of the AI Assistant.
It feels like collaborating with the AI Assistant in various scenes of development work.

I didn't introduce them here, but there are also features like:

I expect the AI Assistant to be extended to be usable in all kinds of scenarios in the future.

In my opinion, if you are a JetBrains user, it's worth continuing to pay the subscription fee.


  1. I know it's not good, but often I make changes impulsively and don't remember what I changed when committing. ↩︎

豆蔵では共に高め合う仲間を募集しています!

recruit

具体的な採用情報はこちらからご覧いただけます。