Skip to content

Commit d54d0bb

Browse files
committed
Merge branch 'main' into drewbat/settings-update-2024-03-14
2 parents d6c5ec4 + f60dd98 commit d54d0bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+696
-291
lines changed

hub/apps/design/controls/listview-filtering.md

Lines changed: 113 additions & 85 deletions
Large diffs are not rendered by default.

hub/apps/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ When the user clicks on your toast, or buttons in the toast, the **Activate** me
225225
Inside the Activate method, you can parse the args that you specified in the toast and obtain the user input that the user typed or selected, and then activate your app accordingly.
226226

227227
> [!NOTE]
228-
> The **Activate** method is called on a separte thread from your main thread.
228+
> The **Activate** method is called on a separate thread from your main thread.
229229
230230
```cpp
231231
// The GUID must be unique to your app. Create a new GUID if copying this code.
@@ -424,4 +424,4 @@ if (IsWindows10OrGreater())
424424

425425
* [Full code sample on GitHub](https://github.com/WindowsNotifications/desktop-toasts)
426426
* [Toast notifications from desktop apps](toast-desktop-apps.md)
427-
* [Toast content documentation](adaptive-interactive-toasts.md)
427+
* [Toast content documentation](adaptive-interactive-toasts.md)

hub/apps/develop/settings/settings-common.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The format of the backup JSON file. Install, Update, and Uninstall nodes contain
6666
"productVersion": Product version obtained from GetFileVersionInfo,
6767
"peImageType": Image type obtained from PE header,
6868
"peSubsystem": Subsystem obtained from PE header,
69-
"runLevel": Executable's runl"evel obtained from app manifest,
69+
"runLevel": Executable's runlevel obtained from app manifest,
7070
"uiAccess": UI access obtained from app manifest,
7171
"crcChecksum": File's CRC checksum,
7272
"clrVersion": CLR version obtained from app manifest,
@@ -675,8 +675,8 @@ These are blobs that are in the registry. There are three things that use regist
675675

676676
These are settings found in File Explorer->Folder options(...)->General tab
677677

678-
* File explorer can be opened to either Home or This PC
679-
* File explorer can be opened to One Drive folder as well if user has signed in to One Drive (This option is available only if user has signed in)
678+
* File explorer can be opened to either Home or This PC
679+
* File explorer can be opened to One Drive folder as well if user has signed in to One Drive (This option is available only if user has signed in)
680680

681681
#### FolderOptionGeneralSettings Properties
682682

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: How to use GitHub Copilot to create WinUI 3 / Windows App SDK apps in Visual Studio
3+
description: Get started with WinUI 3 / Windows App SDK by integrating GitHub Copilot code autocompletion capabilities into Visual Studio.
4+
ms.topic: article
5+
ms.date: 3/12/2024
6+
keywords: windows app sdk, winappsdk, winui3, copilot
7+
ms.author: mikben
8+
author: matchamatch
9+
ms.localizationpriority: medium
10+
ms.custom: template-quickstart
11+
audience: new-desktop-app-developers
12+
content-type: how-to
13+
---
14+
15+
# Use GitHub Copilot to create WinUI 3 / Windows App SDK apps in Visual Studio
16+
17+
In this how-to, we'll demonstrate how [GitHub Copilot](https://github.com/features/copilot) can be used to build WinUI 3 / Windows App SDK desktop apps in Visual Studio. This guide builds upon *[What is the GitHub Copilot extension for Visual Studio?](/visualstudio/ide/visual-studio-github-copilot-extension)*, offering tailored tips and best practices for Copilot-assisted WinUI 3 app development.
18+
19+
:::image type="content" source="images/github-copilot-winui-vs/github-copilot-extension-example.gif" alt-text="Animated screenshot that shows the code completion capabilities of the GitHub Copilot extension.":::
20+
21+
## Prerequisites
22+
23+
- [Visual Studio 2022 (v17.6+) and Tools for Windows App SDK](../windows-app-sdk/set-up-your-development-environment.md)
24+
- An active subscription to [GitHub Copilot](https://github.com/features/copilot/plans) associated with the GitHub account that you sign in to Visual Studio with.
25+
- Familiarity with C# and WinUI 3 / Windows App SDK.
26+
27+
## Installation
28+
29+
1. In Visual Studio, select **Extensions** > **Manage Extensions**.
30+
2. Search for "GitHub Copilot" and click `Download`. Optionally, you can also install the [GitHub Copilot Chat Extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) to enable Copilot's interface.
31+
3. Restart Visual Studio.
32+
4. Click `Modify` when prompted to install the extension.
33+
34+
35+
## Use GitHub Copilot
36+
37+
### Autocomplete your code snippets
38+
39+
The GitHub Copilot extension provides real-time code suggestions and completions based on the code you write. The most straightforward way to use Copilot is to start typing code in the editor, and Copilot will try to autocomplete your code snippet. You can then accept or dismiss the suggestions:
40+
41+
<!-- todo: animated gifs as an optimization -->
42+
43+
:::image type="content" source="images/github-copilot-winui-vs/1-basic-autocomplete.png" alt-text="Screenshot that shows the code completion capabilities of the GitHub Copilot extension (basic autocomplete).":::
44+
45+
### Generate multiple autocomplete suggestions
46+
47+
Select `Edit` -> `Copilot suggestions` -> `Open Copilot`. A window will open with a list of suggestions based on the latest cursor position:
48+
49+
:::image type="content" source="images/github-copilot-winui-vs/2-generate-multiple-autocomplete-suggestions.png" alt-text="Screenshot that shows the code completion capabilities of the GitHub Copilot extension (multiple autocomplete).":::
50+
51+
### Prompt Copilot with plain-language comments
52+
53+
Although Copilot is used primarily for code completion, you can also use natural language comments to guide Copilot in generating specific code snippets. For example, you can use comments to request a specific feature or functionality:
54+
55+
:::image type="content" source="images/github-copilot-winui-vs/3-prompt-copilot-with-inline-comment.png" alt-text="Screenshot that shows the code completion capabilities of the GitHub Copilot extension (prompting).":::
56+
57+
### Use temporary comments to add code from other files to Copilot's context
58+
59+
If you're working on a code-behind file and want Copilot to incorporate context from the associated XAML file, you can use temporary comments to include this additional code within Copilot's context. Here's an example of how you can specify the XAML code first, and then have Copilot generate the corresponding C# code:
60+
61+
:::image type="content" source="images/github-copilot-winui-vs/4-add-context-temporary-comments.png" alt-text="Screenshot that shows the code completion capabilities of the GitHub Copilot extension (context expansion).":::
62+
63+
### Ask Copilot to explain how something works with inline comments
64+
65+
You can use inline comments to ask Copilot to explain how a specific piece of code works. This is similar to using the Copilot Chat Extension, except your prompt is typed directly into the code editor:
66+
67+
:::image type="content" source="images/github-copilot-winui-vs/5-ask-copilot-inline-explanation.png" alt-text="Screenshot that shows the code completion capabilities of the GitHub Copilot extension (explain).":::
68+
69+
### Use Copilot to test code standards
70+
71+
You can use Copilot to generate code that adheres to your project's coding standards, and to test any given snippet's adherence to those standards. Here's an example of how you can use inline comments to specify two conventions, and then have Copilot validate the code snippet against these conventions:
72+
73+
:::image type="content" source="images/github-copilot-winui-vs/6-enforce-code-standards.png" alt-text="Screenshot that shows the code completion capabilities of the GitHub Copilot extension (standards).":::
74+
75+
## Recap
76+
77+
In this how-to, we demonstrated how to use the GitHub Copilot extension to assist you with WinUI 3 / Windows App SDK desktop app development in Visual Studio. We covered how to:
78+
79+
- Autocomplete your code snippets.
80+
- Generate multiple autocomplete suggestions.
81+
- Prompt Copilot with plain-language comments.
82+
- Use temporary comments to add code from other files to Copilot's context.
83+
- Ask Copilot to explain how something works with inline comments.
84+
- Use Copilot to test and enforce code standards.
85+
86+
87+
## Related
88+
89+
- [Sample applications for Windows development](../get-started/samples.md)
90+
- [Windows developer FAQ](../get-started/windows-developer-faq.yml)
91+
- [Windows developer glossary](../get-started/windows-developer-glossary.md)
92+
- [Windows development best practices](../get-started/best-practices.md)
93+
- [How to target multiple platforms with your WinUI 3 app](uno-multiplatform.md)
9.74 KB
Loading
19.8 KB
Loading
6.51 KB
Loading
15.6 KB
Loading
14 KB
Loading
16.1 KB
Loading

0 commit comments

Comments
 (0)