Interacting with Tabnine Chat

How to interact with Tabnine Chat

You can interact and trigger Tabnine Chat in three ways:

Option 1: Free-form natural language prompt

Go to the bottom of the Tabnine Chat panel, enter a free text question or instruction, and then click Enter.

Tabnine Chat's answer will be rendered quickly:

Another recommended option is to select a block of code from the current open file and then ask a question regarding this code. This draws Tabnine Chat's attention to the relevant code:

You can ask anything you want, but keep in mind that Tabnine Chat was designed to answer questions related to code. If you write good prompts that are specific, detailed, and to the point, you increase the chances of getting an accurate and useful result.

Mentions

In the natural language prompt, you can use Mentions.

Mentions (using the @ symbol) are a way to ask Tabnine Chat to use a specific code element (type, method, or class) from the workspace in the query context. Mentions allow the user to leverage their domain knowledge and help the AI by explicitly focusing it on relevant context from the workspace.

Notes:

  1. Mentions work for each language with Language Server Protocol (LSP) support in the IDE.

  2. Type 2-3 characters after the “@” to view the available code elements.

Learn more about the Tabnine Chat context and prompt engineering.

Option 2: Quick actions (global)

Some tasks or instructions are common, so Tabnine Chat includes them as built-in actions.

The following actions operate on the selected code:

  • explain-code: Explains what the selected code is doing

  • generate-test-for-code: Writes tests for the selected code

  • document-code: Suggests documentation for the selected code

  • fix-code: Fixes the errors (detected by the IDE) for the selected code

You can trigger quick actions by clicking the relevant links when you start a new chat session:

Another option is to use "/" to view the available quick actions. Select the action you want and click Enter.

User-defined quick actions

In addition to the predefined commands provided by Tabnine, you can define your own custom commands. This can be useful for repetitive tasks that are specific to your domain:

To define your own quick action, follow these steps:

  1. On the Chat settings tab, click Add in the Define custom commands section.

  1. Fill in the slash command name, description, and prompt template fields in the Define new Command dialog. Use $ to include a reference to the selected code or open file and save the custom command.

  1. Use the slash ("/") to trigger your custom commands in the chat prompt.

Note: Custom commands are personal and saved on the local machine, per IDE. They're not shared between different users or between different IDEs on the same machine.

Option 3: CodeLens (method scope)

Available in these IDEs (for these languages):

  • VS Code (Java, Python, TypeScript & TSX, JavaScript & JSX, Ruby, Go, Rust, Swift, C/C++, C#, PHP)

  • JetBrains (Java, Python, TypeScript, Rust, Kotlin, PHP, GO, C/CPP, C#)

  • Visual Studio (all supported languages)

You can trigger the quick actions for the scope of a specific method by clicking the floating Tabnine quick actions:

Last updated