Ability to generate code in multiple files with AI Assistant

Answered

Is it possible to generate the code in multiple files from a single prompt, the way it's possible in Cursor? When working on a feature, it's common to touch multiple files:
1. create DTO class in […].dto.ts file
2. create  endpoint in […].controller.ts file and use DTO class class as body type
3. add some business logic in […].service.ts class and call it from endpoint

Cursor Composer can do this with a single prompt and offers preview of all 3 files and changes in them. If I wish to replicate similar workflow with AI Assistant in IntelliJ, 
1. I'll have to talk with it via chat and copy/paste relevant snippets OR
2. navigate to multiple files and generate very “locally scoped” code while I keep track of the overall progress of implementation in my head and use Assistant just to generate snippets of the code and not the whole feature.

With Cursor Composer I could generally implement 90% of the feature with a single prompt (and followup refinements, similar to how I can do them with AI Assistant) but with Assistant, I have to write multiple prompts, each in their own file.

0
6 comments

Try “Continue”, it supports multiple files.

0

Hello Matic Leva ,

Unfortunately, it's not possible yet to generate multiple files in AI Assistant.

A similar feature request is reported in https://youtrack.jetbrains.com/issue/LLM-7148.

Please vote for it to prioritize it for the development team and receive notifications from the ticket.

0

Above link is dead, does that mean you have stopped working on it ??

0

Harshasuranjith 
Actually the link is not dead, there was a dot character included in the URL. Here it is: https://youtrack.jetbrains.com/issue/LLM-7148. It is currently in progress, but there is no specific planned date yet, unfortunately. Please follow the report for progress updates.

0

I tried to have the AI assistant generate a bunch of POJO classes representing  the content of an XML file. The result was abysmal. A: It could only generate sources in the chat; for each single class, I had to click a little icon to have it create a source file in the actual project folder and copy the code in it. B: The generated source files had invalid names; they were different than the name of the actual classes, instantly resulting in a compiler error. So I had to manually rename each and every file. Until I realized that… C: the content was incomplete. The assistant generated classes, members and accessor methods only for some of the XML contents - but not all. D: On top of it all, it chose to weirdly add a “Config” suffix to each and every class for no obvious reason.

After messing with it for about two hours I gave up and created the POJO classes myself. Considering this is, from my point of view, a very typical use-case were AI support should make things very easy and quick, this was very disappointing. Especially the fact that the AI assistant is really just a very poorly integrated AI chat window with now actual access to the project folder makes this a bad joke to me.

0

Marcel Schön 
Sorry to hear about your experience. The automatic file generation from AI chat is being reworked currently. The new implementation is planned for the next stable release - 2025.1. It should fix the issues you mentioned. As for the incorrect file name when invoking ‘Create File from Snippet’, it is a known issue, it is also being worked on.

The mentioned reports in the issue tracker are internal/private unfortunately:

0

Please sign in to leave a comment.