Chat with AI Assistant
Use the AI Assistant window
Use the AI Assistant tool window to ask questions about programming-related topics, or iterate on a task. The AI Assistant takes into consideration the language and technologies used in your solution.
In the input field of the AI Assistant tool window, type your question and press Enter to submit your query.
Each code snippet in the AI Assistant reply can be quickly reused — click the icons in the top right corner of the snippet to copy or insert it into the editor.
Your conversations with the AI Assistant can be organized in separate chats, which is helpful if you want to return to a specific conversation later. The set of queries and responses in each chat builds up a unique context for that chat, which is taken into account by the language model to give more relevant responses to queries that relate to the chat's topic.
To create a new chat, click the ... button and choose either New Chat to start a new conversation from scratch or Duplicate to create a new conversation as a continuation of the current one.
The list of chats is linked to a specific solution, and this list becomes available when you reopen the solution, even if you restart Visual Studio. To see the list of chats, click the hamburger icon in the top left corner of the AI Assistant tool window:
Names of the chats are generated automatically and contain the summary of the initial query. If necessary, you can rename or delete a chat by clicking the ... button next to it in the list of chats.
Change chat font size
Select Alt+R O, then choose on the left.
from the main menu or pressUnder AI Chat font size, choose Standard or Large.
Ask AI about the current context
If you have any questions about the code in the editor, press Alt+Enter and choose Ask AI.
In the popup that opens, type your question. You don't have to provide any details about the code, the context around your caret will be taken into account.
Press Enter or click the arrow to send the question to the AI Assistant. The response will appear in the AI Assistant window, where you can then ask for additional details if needed.
Smart chat
The most relevant and helpful responses are provided by the AI Assistant in the smart chat mode. Smart chat is enabled by default, and you can disable it if needed by clearing the corresponding checkbox on the page of ReSharper options Alt+R, O.
When the smart chat is enabled, ReSharper can access the source code of your solution, currently opened documents, Git history, and other project-related information and share it with the JetBrains AI service to significantly improve the relevance of the AI Assistant suggestions and make it able to answer questions related to your solution. For example, when you ask the assistant to explain the selected code, it will be able to analyze usages of that code in your solution and come up with a more meaningful explanation.
Otherwise, AI Assistant will answer your questions and generate suggestions using only the generic training data of the underlying language model.
Sliding context window
Each AI Assistant chat works as a context window, where all subsequent queries are processed in the context of previous queries in that chat. There is a limit of the context window set by the underlying AI model, which also limits the length of the chat.
To overcome this limit, ReSharper enables sliding context window, which starts discarding the oldest queries and responses when the limit is reached and thus always keeps the context window within the limit.
If you disable this option on the
page of ReSharper options , the behavior of the chat changes: as soon as it reaches the limit, it suggests making the initial part of the conversation smaller by summarizing it.