DataGrip 2024.3 Help

Use AI to convert files to another language

Install the AI Assistant plugin

This functionality relies on the AI Assistant plugin, which you need to install and enable.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Marketplace tab, find the AI Assistant plugin, and click Install (restart the IDE if prompted).

With AI Assistant, you can convert your code from one programming language to another.

Convert the whole file to another language

  1. Open a file you want to convert, place the caret anywhere in the editor, and right-click to open the context menu.

    Alternatively, press Alt+Enter.

  2. Select AI Actions and then Convert File to Another Language.

  3. In the list that opens, select the language you want to convert the current file to.

    Target Language list

    After the conversion, the converted file is saved as a separate file with a new extension.

    Converted file with updated extension

Enable converting code to another language by copy-and-paste

  1. Press Ctrl+Alt+S to open settings and then select Tools | AI Assistant.

  2. Enable the Suggest converting pasted code to the language of the target file option and click Apply.

    Selected option that enables converting pasted code

Now you can copy the piece of code you want to convert and paste it into the file you work on.

AI Assistant detects the language of the pasted code and suggests to convert it to the language of the opened file.

Convert Pasted Code dialog

If you click Convert, the code will be converted to the language of the target file. The code in original language will also be pasted, but commented out.

Commented-out code in original language above the converted code
Last modified: 18 July 2024