From ac58cc1fac05e0b868908d4fa0a04ec1fb076e58 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Fri, 6 Dec 2024 10:10:34 +1100 Subject: [PATCH] Adding copilot-instructions (#308) * Experimenting using copilot-instructions.md Feature info: https://docs.github.com/en/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot * Apply suggestions from code review Co-authored-by: David Pine --------- Co-authored-by: David Pine --- .github/copilot-instructions.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..8a923b8c --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,26 @@ +## Coding Style + +- Use spaces for indentation with four-spaces per level, unless it is a csproj file, then use two-spaces per level. +- For integrations use the following namespace rules: + - If the integration is a hosting integration (starts with CommunityToolkit.Aspire.Hosting), extension methods should be placed in `Aspire.Hosting`. + - If the integration is a client integration (starts with CommunityToolkit.Aspire), extension methods should be placed in `Microsoft.Extensions.Hosting`. + - Use file-scoped namespaces. +- All public members require doc comments. +- Prefer type declarations over `var` when the type isn't obvious. + +## Sample hosting integration + +```csharp +namespace Aspire.Hosting; + +public static class SomeProgramExtensions +{ + public static IResourceBuilder AddSomeProgram( + this IDistributedApplicationBuilder builder, + [ResourceName] string name) + { + var resource = new SomeProgramResource(name); + return builder.AddResource(resource); + } +} +```