DataGrip 2025.3 Help

Code completion

Basic code completion helps you complete statements, database object names, parameters, and keywords within the visibility scope.

DataGrip analyzes the context and suggests the choices that are reachable from the current caret position. Suggestions also include Live templates. Completion is available for a non-English keyboard layout.

Invoke basic completion

  • By default, DataGrip displays the code completion popup automatically as you type.

    Alternatively, you can press Ctrl+Space or select Code | Code Completion | Basic from the main menu.

  • Code completion is available for custom file types. However, DataGrip does not recognize the structure of such files and suggests options regardless of whether they are appropriate in the current context.

Accept a suggestion from the list

  • Press Enter or double-click the relevant list item to insert it to the left of the caret.

  • Press Tab to replace the characters to the right from the caret.

  • Use Ctrl+Shift+Enter to make the current code construct syntactically correct (balance parentheses, add missing braces and semicolons, and so on).

  • Use specific keys and custom characters to accept the selected completion suggestion. To enable these features, go to the Editor | General | Code Completion settings page  Ctrl+Alt+S and do the following:

    1. To use specific keys, select the Insert selected suggestion by pressing space, dot, or other context-dependent keys checkbox. These keys depend on the language, your context, and so on.

    2. To also use custom characters, enter the characters into the Additional characters to accept the completion field.

Completion actions

Consider the following list of actions that you can perform with basic code completion:

Complete a list of fields for SELECT statements

  • Complete a list of fields for SELECT statements.

    Example of the SELECT statement completion

Complete JOIN statements by using a foreign key

  • Complete the JOIN statement if tables are connected with a foreign key. To invert an order of operands in the JOIN condition, open Settings Ctrl+Alt+S and navigate to Editor | General | Code Completion. In the SQL | JOIN clauses section, select the Invert order of operands in auto-generated ON clause checkbox. Compare an order of operands on the following screenshot with this option on and off.

    Example of the JOIN statement completion

Complete a list of fields for INSERT statements

  • Complete a list of fields for INSERT statements.

    Example of the INSERT statement completion

Completion for window functions

  • When you use a window function, DataGrip automatically adds OVER() and puts the caret into the appropriate place.

Complete a list of fields for GROUP BY statements

  • Complete a list of fields for GROUP BY statements.

    Example of the INSERT statement completion

Complete abbreviated names

  • Complete names of database objects that are written in camelCase, hyphenated-object-names, or names_with_underscore. To start completion, use the first letters of words in the name.

    Example of completion for abbreviated names

Complete abbreviated statements

  • Complete names of abbreviated statements. To start completion, use the first letters of words in the name.

    Example of completion for abbreviated names

Complete names of new objects

  • Complete names of newly created objects in a DDL statement (for example, after the ALTER clause).

    Example of the ALTER statement completion

Generate aliases

  • Generate aliases for objects. To display the suggestion list, press Ctrl+Space.

  • To automatically add an alias for a table when you use auto-completion, go to Settings Ctrl+Alt+S and navigate to Editor | General | Code Completion. In the SQL | Table aliases section, select the Automatically add aliases when completing table names checkbox. After that, each time you autocomplete a table name, DataGrip will generate an alias for the table.

    If you want to set your own aliases for database objects, click the Add alias icon in the Custom aliases table. Type the object name in the Table name column and the desired alias in the Alias column.

    Generate aliases

Machine learning-assisted completion ranking

DataGrip allows you to prioritize completion suggestions based on choices that other users made in similar situations.

The ML completion mechanism does not add any new elements but orders the elements retrieved from code. Data is not exposed anywhere; it is collected locally.

Enable ML completion ranking

  1. Press Ctrl+Alt+S to open settings and select Editor | General | Code Completion.

  2. Under Machine Learning-Assisted Completion, enable the Sort completion suggestions based on machine learning option and select the languages for which you want to use the ML completion.

    ML-assisted completion settings

Enable relevance markers

  1. Press Ctrl+Alt+S to open settings and select Editor | General | Code Completion.

  2. Enable the following options:

    • Mark position changes in the completion popup: use the Machine Learning ranking Up and Machine Learning ranking Down icons to indicate whether the relevance of a suggestion is increasing or decreasing and therefore the suggestion has moved up or down the suggestion list.

    • Mark the most relevant item in the completion popup: use the ML relevant proposal icon to indicate the most suitable suggestion on the list.

    ML-assisted completion with markers

Code completion settings

To configure code completion settings, go to the Editor | General | Code Completion settings page  Ctrl+Alt+S. For more information about the settings, refer to the Code Completion topic.

Completion tips and tricks

Autocomplete HTTP constants by typing the code number

  • After you specify an imported package name, such as http, you can type 404 to autocomplete the value to http.StatusNotFound.

Narrow down the suggestion list

  • Narrow down the suggestion list by typing any part of a word (even characters from somewhere in the middle) or invoking code completion after a dot separator .

    DataGrip displays suggestions containing the characters you've entered, regardless of their position. This makes the use of wildcards unnecessary.

    In case of CamelCase or snake_case names, type the initial letters only. DataGrip automatically recognizes and matches the initial letters.

    Code completion Wild Card

View reference

  • You can use the Quick Information view by pressing Ctrl+Q or automatically when you select an entry in the suggestion list:

    Quick documentation

Troubleshooting

If code completion does not work, this may be due to one of the following reasons:

  • The Power Save Mode is on (File | Power Save Mode). Turning it on minimizes power consumption of your laptop by eliminating the background operations, including error highlighting, on-the-fly inspections, and code completion.

  • Code completion popup might not appear automatically if it takes too long to gather the completion options. For example, if the computer is busy with another task. In this case, you may still activate the completion popup manually via Ctrl+Space.

19 November 2025