diff --git a/content/copilot/concepts/about-customizing-github-copilot-chat-responses.md b/content/copilot/concepts/about-customizing-github-copilot-chat-responses.md index fed25085bf38..4ce8951b10a5 100644 --- a/content/copilot/concepts/about-customizing-github-copilot-chat-responses.md +++ b/content/copilot/concepts/about-customizing-github-copilot-chat-responses.md @@ -28,6 +28,16 @@ redirect_from: {% endvisualstudio %} +{% jetbrains %} + +> [!NOTE] This version of this article is about custom instructions in JetBrains IDEs. Click the tabs above for other environments. +{% endjetbrains %} + +{% xcode %} + +> [!NOTE] This version of this article is about custom instructions in Xcode. Click the tabs above for other environments. +{% endxcode %} + ## About customizing {% data variables.copilot.copilot_chat %} responses {% webui %} @@ -61,6 +71,18 @@ While custom instructions help to add codebase-wide context to each AI workflow, {% endvisualstudio %} +{% jetbrains %} + +{% data variables.product.prodname_copilot %} can provide chat responses that are tailored to the way your team works, the tools you use, or the specifics of your project, if you provide it with enough context to do so. Instead of repeatedly adding this contextual detail to your chat questions, you can create a custom instructions file in your repository that automatically adds this information for you. The additional information is not displayed in the chat, but is available to {% data variables.product.prodname_copilot_short %} to allow it to generate higher quality responses. + +{% endjetbrains %} + +{% xcode %} + +{% data variables.product.prodname_copilot %} can provide chat responses that are tailored to the way your team works, the tools you use, or the specifics of your project, if you provide it with enough context to do so. Instead of repeatedly adding this contextual detail to your chat questions, you can create a custom instructions file in your repository that automatically adds this information for you. The additional information is not displayed in the chat, but is available to {% data variables.product.prodname_copilot_short %} to allow it to generate higher quality responses. + +{% endxcode %} + {% webui %} ## Using custom instructions @@ -169,6 +191,42 @@ Common use cases include: {% endvisualstudio %} +{% jetbrains %} + +## About repository custom instructions + +Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository. The instructions you add to the file should be short, self-contained statements that add context or relevant information to supplement chat questions. + +Common use cases include: + +* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework. +* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code. +* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include. + +### Example + +{% data reusables.copilot.repository-custom-instructions-example %} + +{% endjetbrains %} + +{% xcode %} + +## About repository custom instructions + +Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository. The instructions you add to the file should be short, self-contained statements that add context or relevant information to supplement chat questions. + +Common use cases include: + +* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework. +* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code. +* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include. + +### Example + +{% data reusables.copilot.repository-custom-instructions-example %} + +{% endxcode %} + ## Next steps {% webui %} @@ -190,3 +248,9 @@ Common use cases include: * [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot) {% endvisualstudio %} + +{% jetbrains %} + +* [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot) + +{% endjetbrains %} diff --git a/content/copilot/how-tos/chat/asking-github-copilot-questions-in-your-ide.md b/content/copilot/how-tos/chat/asking-github-copilot-questions-in-your-ide.md index f8bf904bca87..044a603e2700 100644 --- a/content/copilot/how-tos/chat/asking-github-copilot-questions-in-your-ide.md +++ b/content/copilot/how-tos/chat/asking-github-copilot-questions-in-your-ide.md @@ -372,7 +372,7 @@ You can ask {% data variables.copilot.copilot_chat_short %} to give you code sug The response often includes interactive elements. For example, the response may include buttons to copy or insert a code block. - To see the files that {% data variables.copilot.copilot_chat_short %} used to generate the response, select the **References** dropdown below the response. + To see the files that {% data variables.copilot.copilot_chat_short %} used to generate the response, click the **References** link below the response. The references may include a link to a custom instructions file for your repository. This file contains additional information that is automatically added to all of your chat questions to improve the quality of the responses. For more information, see [AUTOTITLE](/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot). ## Using keywords in your prompt @@ -488,6 +488,8 @@ You can ask {% data variables.copilot.copilot_chat_short %} to give you code sug The response often includes interactive elements. For example, the response may include buttons to copy or insert a code block. + To see the files that {% data variables.copilot.copilot_chat_short %} used to generate the response, click the **References** link below the response. The references may include a link to a custom instructions file for your repository. This file contains additional information that is automatically added to all of your chat questions to improve the quality of the responses. For more information, see [AUTOTITLE](/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot). + ## AI models for {% data variables.copilot.copilot_chat_short %} {% data reusables.copilot.change-the-ai-model %} diff --git a/content/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot.md b/content/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot.md index 80d91a583739..9ce1b511a9de 100644 --- a/content/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot.md +++ b/content/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot.md @@ -116,6 +116,42 @@ This version of this article is for using repository custom instructions in {% d {% endvisualstudio %} +{% jetbrains %} + +> [!NOTE] This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change. + +This version of this article is for using repository custom instructions in JetBrains IDEs. Click the tabs above for instructions on using custom instructions in other environments. + +## About repository custom instructions for {% data variables.copilot.copilot_chat %} + +Repository custom instructions are currently supported for {% data variables.copilot.copilot_chat_short %} in JetBrains IDEs, {% data variables.product.prodname_vs %}, {% data variables.product.prodname_vscode_shortname %}, Xcode, and on the {% data variables.product.github %} website. + +{% data variables.product.prodname_copilot %} can provide chat responses that are tailored to the way your team works, the tools you use, or the specifics of your project, if you provide it with enough context to do so. Instead of repeatedly adding this contextual detail to your chat questions, you can create a file in your repository that automatically adds this information for you. The additional information is not displayed in the chat, but is available to {% data variables.product.prodname_copilot_short %} to allow it to generate higher quality responses. + +### Example + +{% data reusables.copilot.repository-custom-instructions-example %} + +{% endjetbrains %} + +{% xcode %} + +> [!NOTE] This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change. + +This version of this article is for using repository custom instructions in Xcode. Click the tabs above for instructions on using custom instructions in other environments. + +## About repository custom instructions for {% data variables.copilot.copilot_chat %} + +Repository custom instructions are currently supported for {% data variables.copilot.copilot_chat_short %} in Xcode, {% data variables.product.prodname_vs %}, {% data variables.product.prodname_vscode_shortname %} JetBrains IDEs, and on the {% data variables.product.github %} website. + +{% data variables.product.prodname_copilot %} can provide chat responses that are tailored to the way your team works, the tools you use, or the specifics of your project, if you provide it with enough context to do so. Instead of repeatedly adding this contextual detail to your chat questions, you can create a file in your repository that automatically adds this information for you. The additional information is not displayed in the chat, but is available to {% data variables.product.prodname_copilot_short %} to allow it to generate higher quality responses. + +### Example + +{% data reusables.copilot.repository-custom-instructions-example %} + +{% endxcode %} + ## Prerequisites for repository custom instructions * You must have a custom instructions file (see the instructions below). @@ -140,17 +176,110 @@ This version of this article is for using repository custom instructions in {% d {% endvisualstudio %} +{% jetbrains %} + +* The latest version of the {% data variables.product.prodname_copilot_short %} extension must be installed in your JetBrains IDE. + +{% endjetbrains %} + +{% xcode %} + +* The latest version of the {% data variables.product.prodname_copilot_short %} extension must be installed in Xcode. + +{% endxcode %} + ## Creating a repository custom instructions file +{% jetbrains %} + +You can create a custom instructions file in your repository using the {% data variables.product.prodname_copilot_short %} settings page, or you can create the file manually. + +Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. + +### Using the settings page + +{% data reusables.copilot.jetbrains-settings %} +{% data reusables.copilot.jetbrains-languages-and-frameworks %} +1. Under "{% data variables.product.prodname_copilot_short %} Instructions", click **Workspace** or **Global** to choose whether the custom instructions apply to the current workspace or all workspaces. + +### Manually creating a workspace custom instructions file + +1. In the root of your repository, create a file named `.github/copilot-instructions.md`. + + Create the `.github` directory if it does not already exist. + +1. Add natural language instructions to the file, in Markdown format. + +Once saved, these instructions will apply to the current workspace in JetBrains IDEs that you open with {% data variables.product.prodname_copilot_short %} enabled. + +### Manually creating a global custom instructions file + +To apply the same instructions across all workspaces in JetBrains IDEs, you can create a global custom instructions file on your local machine. + +1. Open your file explorer or terminal. +1. Navigate to the appropriate location for your operating system: + + * **macOS**: + `/Users/YOUR-USERNAME/.config/github-copilot/intellij/` + * **Windows**: + `C:\Users\YOUR-USERNAME\AppData\Local\github-copilot\intellij\` + +1. Create a file named `global-copilot-instructions.md` in that directory. +1. Add your custom instructions in natural language, using Markdown format. + +Once saved, these instructions will apply globally across all workspaces in JetBrains IDEs that you open with {% data variables.product.prodname_copilot_short %} enabled. + +{% endjetbrains %} + +{% xcode %} + +You can create a custom instructions file in your repository via the {% data variables.product.prodname_copilot_short %} settings page. + +Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. + +1. Open the {% data variables.product.prodname_copilot %} for Xcode application. +1. At the top of the application window, click **Advanced**. +1. To the right of "Custom Instructions", click **Current Workspace** or **Global** to choose whether the custom instructions apply to the current workspace or all workspaces. + +{% endxcode %} + +{% vscode %} + +1. In the root of your repository, create a file named `.github/copilot-instructions.md`. + + Create the `.github` directory if it does not already exist. + +1. Add natural language instructions to the file, in Markdown format. + + Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. + +{% endvscode %} + +{% visualstudio %} + 1. In the root of your repository, create a file named `.github/copilot-instructions.md`. Create the `.github` directory if it does not already exist. 1. Add natural language instructions to the file, in Markdown format. - Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility.{% webui %} + Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. -To see your instructions in action, go to [https://github.com/copilot](https://github.com/copilot), attach the repository containing the instructions file, and start a conversation.{% endwebui %} +{% endvisualstudio %} + +{% webui %} + +1. In the root of your repository, create a file named `.github/copilot-instructions.md`. + + Create the `.github` directory if it does not already exist. + +1. Add natural language instructions to the file, in Markdown format. + + Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. + +To see your instructions in action, go to [https://github.com/copilot](https://github.com/copilot), attach the repository containing the instructions file, and start a conversation. + +{% endwebui %} {% note %} @@ -216,16 +345,22 @@ You can click the reference to open the file. {% endvisualstudio %} -## Enabling or disabling repository custom instructions +{% jetbrains %} -You can choose whether or not you want {% data variables.product.prodname_copilot_short %} to use repository-based custom instructions. +{% data reusables.copilot.custom-instructions-reference %} -### Enabling or disabling custom instructions for {% data variables.copilot.copilot_chat_short %} +{% endjetbrains %} -Custom instructions are enabled for {% data variables.copilot.copilot_chat_short %} by default but you can disable, or re-enable, them at any time. This applies to your own use of {% data variables.copilot.copilot_chat_short %} and does not affect other users. +{% xcode %} + +{% data reusables.copilot.custom-instructions-reference %} + +{% endxcode %} {% webui %} +{% data reusables.copilot.custom-instructions-enabling %} + 1. On {% data variables.product.prodname_dotcom_the_website %}, do one of the following: * Go to a repository with a custom instructions file and open the assistive chat panel. * Go to the immersive view of {% data variables.copilot.copilot_chat_short %} ([github.com/copilot](https://github.com/copilot)) and attach a repository that contains a custom instructions file. @@ -237,18 +372,26 @@ Custom instructions are enabled for {% data variables.copilot.copilot_chat_short Your choice persists, for all repositories containing a custom instructions file, until you change it. +{% data reusables.copilot.custom-instructions-enabling-for-ccr %} + {% endwebui %} {% vscode %} +{% data reusables.copilot.custom-instructions-enabling %} + 1. Open the Setting editor by using the keyboard shortcut Command+, (Mac) / Ctrl+, (Linux/Windows). 1. Type `instruction file` in the search box. 1. Select or clear the checkbox under **Code Generation: Use Instruction Files**. +{% data reusables.copilot.custom-instructions-enabling-for-ccr %} + {% endvscode %} {% visualstudio %} +{% data reusables.copilot.custom-instructions-enabling %} + 1. In the {% data variables.product.prodname_vs %} menu bar, under **Tools**, click **Options**. ![Screenshot of the {% data variables.product.prodname_vs %} menu bar. The "Tools" menu is expanded, and the "Options" item is highlighted with an orange outline.](/assets/images/help/copilot/vs-toolbar-options.png) @@ -256,16 +399,9 @@ Your choice persists, for all repositories containing a custom instructions file 1. In the "Options" dialog, type `custom instructions` in the search box, then click **{% data variables.product.prodname_copilot_short %}**. 1. Select or clear the checkbox for **(Preview) Enable custom instructions to be loaded from .github/copilot-instructions.md files and added to requests**. -{% endvisualstudio %} - -### Enabling or disabling custom instructions for {% data variables.copilot.copilot_code-review_short %} +{% data reusables.copilot.custom-instructions-enabling-for-ccr %} -Custom instructions are enabled for {% data variables.copilot.copilot_code-review_short %} by default but you can disable, or re-enable, them in the repository settings on {% data variables.product.prodname_dotcom_the_website %}. This applies to {% data variables.product.prodname_copilot_short %}'s use of custom instructions for all code reviews it performs in this repository. - -{% data reusables.repositories.navigate-to-repo %} -{% data reusables.repositories.sidebar-settings %} -1. In the "Code & automation" section of the sidebar, click **{% octicon "copilot" aria-hidden="true" aria-label="copilot" %} {% data variables.product.prodname_copilot_short %}**, then **Code review**. -1. Toggle the “Use custom instructions when reviewing pull requests” option on or off. +{% endvisualstudio %} {% vscode %} diff --git a/data/reusables/copilot/custom-instructions-enabling-for-ccr.md b/data/reusables/copilot/custom-instructions-enabling-for-ccr.md new file mode 100644 index 000000000000..a651baa7dd00 --- /dev/null +++ b/data/reusables/copilot/custom-instructions-enabling-for-ccr.md @@ -0,0 +1,8 @@ +### Enabling or disabling custom instructions for {% data variables.copilot.copilot_code-review_short %} + +Custom instructions are enabled for {% data variables.copilot.copilot_code-review_short %} by default but you can disable, or re-enable, them in the repository settings on {% data variables.product.prodname_dotcom_the_website %}. This applies to {% data variables.product.prodname_copilot_short %}'s use of custom instructions for all code reviews it performs in this repository. + +{% data reusables.repositories.navigate-to-repo %} +{% data reusables.repositories.sidebar-settings %} +1. In the "Code & automation" section of the sidebar, click **{% octicon "copilot" aria-hidden="true" aria-label="copilot" %} {% data variables.product.prodname_copilot_short %}**, then **Code review**. +1. Toggle the “Use custom instructions when reviewing pull requests” option on or off. diff --git a/data/reusables/copilot/custom-instructions-enabling.md b/data/reusables/copilot/custom-instructions-enabling.md new file mode 100644 index 000000000000..c87588d0b174 --- /dev/null +++ b/data/reusables/copilot/custom-instructions-enabling.md @@ -0,0 +1,7 @@ +## Enabling or disabling repository custom instructions + +You can choose whether or not you want {% data variables.product.prodname_copilot_short %} to use repository-based custom instructions. + +### Enabling or disabling custom instructions for {% data variables.copilot.copilot_chat_short %} + +Custom instructions are enabled for {% data variables.copilot.copilot_chat_short %} by default but you can disable, or re-enable, them at any time. This applies to your own use of {% data variables.copilot.copilot_chat_short %} and does not affect other users.