How to generate/change code using Codex?

Answered

In IntelliJ IDEA Ultimate you now can use codex to generate code or modify projects using your ChatGPT account. This works great, but how to use codex on a selected piece of code or you would like something added at the cursor location of a file?

Thank you

Tim

0
2 comments

Currently, the Codex in IntelliJ IDEA primarily operates in context, either file or project. Therefore, to modify a specific piece of code, you need to select that code before calling the Codex. If you don't select it, the Codex will default to assuming you want to edit the entire file. Inserting code precisely at the cursor position is still quite limited and heavily dependent on how you specify the prompt.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/32889937408914-How-to-generate-change-code-using-That's Not My Neighbor-Codex

 

0
Hello, Time. To use Codex on a selected piece of code, select the code, open the AI Assistant chat (via the widget in the top-right corner or using the floating toolbar), and the selected code will be automatically attached as context, or you can use the `@selection` reference in your prompt. To add code at the cursor location, place the cursor where you want to insert new code, open the AI Assistant chat, and when Codex provides a code snippet, use the "Insert at caret" button to add it at the current cursor position.
1

Please sign in to leave a comment.