You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/copilot-chat-context.md
+35-8Lines changed: 35 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: 'Tips & Tricks for GitHub Copilot Chat in Visual Studio'
3
3
description: Use slash commands, references, and threads to form better questions and get better answers with scoped context in GitHub Copilot Chat.
4
-
ms.date: 7/29/2024
4
+
ms.date: 8/13/2024
5
5
ms.topic: how-to
6
6
author: anandmeg
7
7
ms.author: meghaanand
@@ -56,25 +56,42 @@ You can use slash commands in a [chat window](visual-studio-github-copilot-chat.
56
56
57
57
## <aname="reference"></a>Reference: scope Copilot results to a particular file or entire solution
58
58
59
-
You can ask your coding related questions in natural language and GitHub Copilot Chat will answer these in the context of the codebase open in Visual Studio. With references you can get more specific about the information you want Copilot to consider when answering your question. By selecting a specific context in your codebase, you're able to form better questions easily without having to write out or paste long pieces of information. Specifying the context also enables Copilot to provide you with more relevant answers.
59
+
You can ask your coding related questions in natural language and GitHub Copilot Chat will answer these in the context of the codebase open in Visual Studio. With references you can get more specific about the information you want Copilot to consider when answering your question.
60
60
61
-
To easily reference a file, simply add a *#* symbol at the beginning of the file name. For example, if you have a file named *BasketService.cs*, refer to it in the chat as *#BasketService.cs*.
61
+
By selecting a specific context in your codebase, you're able to form better questions easily without having to write out or paste long pieces of information. Specifying the context also enables Copilot to provide you with more relevant answers.
62
+
63
+
### Reference a file
64
+
65
+
To easily reference a file in GitHub Copilot Chat, simply add a *#* symbol at the beginning of the file name. For example, if you have a file named *BasketService.cs*, refer to it in the chat as *#BasketService.cs*.
62
66
63
67
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-context-hash-reference.png" alt-text="Screenshot of references in Copilot Chat.":::
64
68
65
-
Use *#solution* to refer to the solution active in the IDE for context.
69
+
### Reference a method, class, or function
70
+
71
+
With [Visual Studio 2022 version 17.11](/visualstudio/releases/2022/release-notes), you can now reference a specific method, class, or function in GitHub Copilot Chat.
72
+
73
+
To easily reference a method, class, or function in GitHub Copilot Chat, simply add a *#* symbol at the beginning of the method, class, or function name. For example, if you have a method named *BasketAddItem*, refer to it in the chat as *#BasketAddItem*.
74
+
75
+
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-references-methods.png" alt-text="Screenshot of references to methods in GitHub Copilot Chat in Visual Studio.":::
76
+
77
+
### Reference the entire solution
78
+
79
+
Use *@workspace* to refer to the solution active in the IDE for context. When using *@workspace* for context, Copilot Chat leverages the information about the files, projects, and configurations that are currently open and being worked on within your IDE. This enables Copilot Chat to provide more relevant and context-aware suggestions and answers.
66
80
67
-
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-context-hash-solution-reference.gif" alt-text="Screenshot of referencing solution context in Copilot Chat.":::
81
+
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-context-at-workspace.gif" alt-text="Screenshot of referencing solution context in Copilot Chat.":::
68
82
83
+
### Usage examples
69
84
Here are some examples of using references for context control:
70
85
71
86
|**Example**|**Context used by Copilot to form the question**|
| What is the purpose of #MyFile.cs: 66-72?| Exact section of the file |
74
89
| Where are the tests in #BasketService.cs?| BasketService.cs |
75
-
| /explain the AddItemToBasket method in #BasketService.cs| AddItemToBasket method in BasketService.cs |
76
-
| Is there a delete basket method in this #solution| Current Solution open in the IDE|
77
-
90
+
| /explain the #AddItemToBasket in #BasketService.cs| AddItemToBasket method in BasketService.cs |
91
+
| Is there a delete basket method in this @workspace| Current solution open in the IDE |
92
+
| I have a test method named #TestCalculator. How can I ensure that it's being executed correctly?| TestCalculator method |
93
+
| Could you explain the differences between classes #BasketService and #OrderService?| BasketService class and OrderService class |
94
+
| In my @workspace where is #AddItemToBasket? | Current solution open in the IDE |
78
95
79
96
## <aname="find-context"></a>Review the sources used by Copilot Chat
80
97
@@ -86,14 +103,24 @@ Copilot Chat displays the context it used after every result, so that you can te
86
103
87
104
If you’re using Copilot Chat extensively to ask questions as you code, you can organize your conversations in a way that keeps them on-topic. Copilot Chat for Visual Studio now provides an easy way to start new conversations (threads) to keep them focused on the task at hand, and keep the context clear so the answers are based on relevant history.
88
105
106
+
### <aname="new-thread"></a>New chat thread
107
+
89
108
You can start a new thread by selecting the **Create new thread** in the chat window.
90
109
91
110
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-new-thread-conversation.png" alt-text="Screenshot of Create new thread icon in Copilot Chat.":::
92
111
112
+
### <aname="switch-thread"></a>Switch chat thread
113
+
93
114
You can select between multiple ongoing threads to provide the right historical context for your question.
94
115
95
116
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-switch-threads.png" alt-text="Screenshot of switching between ongoing threads in Copilot Chat.":::
96
117
118
+
### <aname="promote-inline"></a>Promote inline chat to the chat window
119
+
120
+
With [Visual Studio 2022 version 17.11](/visualstudio/releases/2022/release-notes), you can now preserve the history of your [inline chat](visual-studio-github-copilot-chat.md#ask-questions-in-the-inline-chat-view) by promoting it to the [chat window](visual-studio-github-copilot-chat.md#ask-questions-in-the-chat-window). Select **Continue in chat window...** to maintain a record and context of the conversation, and continue in the chat window.
121
+
122
+
:::image type="content" source="media/vs-2022/copilot-chat-context/promote-inline-chat-to-chat-window.png" alt-text="Screenshot of promoting ongoing thread in inline chat to the chat window.":::
123
+
97
124
## Next steps
98
125
99
126
-[GitHub Copilot extension for Visual Studio](visual-studio-github-copilot-extension.md)
@@ -39,7 +39,7 @@ All shortcuts in this section apply globally unless otherwise specified. The *Gl
39
39
> [!TIP]
40
40
> You can [look up the shortcut](identifying-and-customizing-keyboard-shortcuts-in-visual-studio.md) for any command by opening the **Options** dialog box, expanding the **Environment** node, and then choosing **Keyboard**.
|Toggle line comment|**Ctrl+/**[Text Editor] <br>(available in [Visual Studio 2022 version 17.11 or later](/visualstudio/releases/2022/release-notes))<br /><br />or **Ctrl+K, Ctrl+/**[Text Editor]| Edit.ToggleLineComment |
Copy file name to clipboardExpand all lines: docs/ide/visual-studio-github-copilot-admin.md
+38-7Lines changed: 38 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Admin controls for GitHub Copilot in Visual Studio
3
3
description: Learn about the new features for administrators in GitHub Copilot for Visual Studio that enable admins to manage Copilot effectively.
4
-
ms.date: 7/30/2024
4
+
ms.date: 8/13/2024
5
5
ms.topic: how-to
6
6
author: anandmeg
7
7
ms.author: meghaanand
@@ -13,17 +13,19 @@ monikerRange: vs-2022
13
13
14
14
# Admin controls for GitHub Copilot
15
15
16
-
Visual Studio 2022 version 17.10 introduces new features for administrators to configure and manage GitHub Copilot for their enterprise effectively.
17
-
In this article, you learn how to disable Copilot for individual accounts or disable Copilot altogether.
16
+
Visual Studio 2022 introduces new features for administrators to configure and manage GitHub Copilot for their enterprise effectively. These features provide administrators greater control over the use of Copilot within their organization. Admins can disable Copilot
## Disabling Copilot for individual Enterprise Visual Studio accounts
20
23
21
-
In version 17.10, we're introducing two new features to disable Copilot, ensuring that your repository is protected.
22
-
Project administrators can disable Copilot for individual accounts or disable Copilot altogether via the [Visual Studio Administrative Templates (ADMX/ADML)](https://www.microsoft.com/en-us/download/details.aspx?id=104405). These features provide administrators with greater control over the use of Copilot within their organization.
24
+
With Visual Studio version 17.10, project administrators can disable Copilot for individual accounts or disable Copilot altogether via the [Visual Studio Administrative Templates (ADMX/ADML)](https://www.microsoft.com/en-us/download/details.aspx?id=104405), ensuring that your repository is protected.
23
25
24
-
To configure and deploy these policies, you can use [Microsoft Intune](../install/administrative-templates.md#deploying-the-policies) or the Local Group Policy Editor directly on the client machine.
26
+
To configure and deploy these policies, you can use [Microsoft Intune](../install/administrative-templates.md#deploying-the-policies) or the [Local Group Policy Editor](#configure-copilot-group-policy) directly on the client machine.
25
27
26
-
## Configure Copilot group policy
28
+
###Configure Copilot group policy
27
29
28
30
1. Head over to the Microsoft Download Center and grab the Visual Studio [Group Policy Administrative Template files (ADMX/ADML)](https://www.microsoft.com/en-us/download/details.aspx?id=104405). It asks you where you want the files to be downloaded, ensure the location is `C:\Windows\PolicyDefinitions`.
29
31
@@ -37,3 +39,32 @@ To configure and deploy these policies, you can use [Microsoft Intune](../instal
37
39
38
40
4. Restart your Visual Studio instance to pick up the new policy changes
39
41
42
+
## Configure content exclusion
43
+
44
+
Content exclusion for GitHub Copilot enables administrators to prevent certain files from being available to Copilot and keep sensitive content secure from Copilot use. You can use content exclusions to configure GitHub Copilot to ignore specific files in a [repository](https://docs.github.com/en/copilot/managing-github-copilot-in-your-organization/configuring-content-exclusions-for-github-copilot#configuring-content-exclusions-for-your-organization) or [organization](https://docs.github.com/en/copilot/managing-github-copilot-in-your-organization/configuring-content-exclusions-for-github-copilot#configuring-content-exclusions-for-your-repository). Content exclusion is only available with a GitHub Copilot Business or a GitHub Copilot Enterprise subscription.
45
+
46
+
With [Visual Studio 2022 version 17.11](/visualstudio/releases/2022/release-notes), GitHub Copilot for Visual Studio will ignore excluded content. When you exclude content from Copilot, completions and chat aren't available on the affected files.
47
+
48
+
### GitHub Copilot Completions in Visual Studio and content exclusions
49
+
50
+
- Code completions aren't available on excluded files.
51
+
52
+
:::image type="content" source="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-completions.png" alt-text="Screenshot of Copilot completions on an excluded file." lightbox="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-completions.png":::
53
+
54
+
- Excluded content isn't included in code completion suggestions in other files.
55
+
56
+
### GitHub Copilot Chat in Visual Studio and content exclusions
57
+
58
+
- Excluded files can't be referenced in the chat window or in inline chat.
59
+
60
+
**Chat window**
61
+
62
+
:::image type="content" source="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-chat-window.png" alt-text="Screenshot of using an excluded file in chat window." lightbox="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-chat-window.png":::
63
+
64
+
**Inline chat**
65
+
66
+
:::image type="content" source="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-chat-inline.png" alt-text="Screenshot of using an excluded file in inline chat." lightbox="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-chat-inline.png":::
67
+
68
+
- Excluded content isn't included in GitHub Copilot Chat's responses.
69
+
70
+
:::image type="content" source="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-chat-response.png" alt-text="Screenshot of chat's responses on excluded content." lightbox="media/vs-2022/visual-studio-github-copilot-admin/copilot-content-exclusions-chat-response.png":::
Copy file name to clipboardExpand all lines: docs/ide/visual-studio-github-copilot-chat.md
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: About GitHub Copilot Chat in Visual Studio
3
3
description: Learn about the fully integrated GitHub Copilot Chat in Visual Studio. Use the chat interface to ask coding-related questions from right within the IDE.
4
-
ms.date: 7/29/2024
4
+
ms.date: 8/13/2024
5
5
ms.topic: overview
6
6
author: anandmeg
7
7
ms.author: meghaanand
@@ -56,6 +56,9 @@ There are two places you can ask Copilot these questions; in a [chat window](#as
56
56
57
57
See [tips to improve Copilot chat](copilot-chat-context.md) results to learn how to use [slash commands](copilot-chat-context.md#slash-commands), [references](copilot-chat-context.md#reference), [sources used](copilot-chat-context.md#find-context), and [threads](copilot-chat-context.md#threads) to get better answers with scoped context in Copilot Chat.
58
58
59
+
>[!NOTE]
60
+
>With Visual Studio 2022 version 17.11, [content exclusion is available for GitHub Copilot Chat](visual-studio-github-copilot-admin.md#github-copilot-chat-in-visual-studio-and-content-exclusions) in Visual Studio. Content excluded by your admin will now be ignored in chat's responses. See [configuring content exclusions for GitHub Copilot](https://docs.github.com/copilot/managing-github-copilot-in-your-organization/configuring-content-exclusions-for-github-copilot?tool=visualstudio) to learn more.
61
+
59
62
### Ask questions in the chat window
60
63
61
64
The chat window of Copilot Chat in Visual Studio enables you to ask your questions and see answers in the chat pane. It is usually the best way to work with Copilot on programming help and general coding questions.
@@ -95,6 +98,10 @@ The inline chat view of Copilot Chat in Visual Studio enables you to ask your qu
95
98
96
99
:::image type="content" source="media/vs-2022/visual-studio-github-copilot-chat/copilot-chat-inline-diff-view.png" alt-text="Screenshot of code suggestions in Visual Studio diff view." lightbox="media/vs-2022/visual-studio-github-copilot-chat/copilot-chat-inline-diff-view.png" :::
97
100
101
+
1. You can promote your inline chat thread to the chat window by selecting **Continue in chat window**. This'll preserve the record and context of your conversation, and you can continue in the chat window.
102
+
103
+
:::image type="content" source="media/vs-2022/visual-studio-github-copilot-chat/promote-inline-chat-to-chat-window.png" alt-text="Screenshot of how to continue the inline chat thread in the chat window." :::
104
+
98
105
1. You can close the inline chat view by pressing **Esc**.
0 commit comments