diff --git a/docs/fundamentals/code-analysis/includes/enabled-on-build-never.md b/docs/fundamentals/code-analysis/includes/enabled-on-build-never.md index 3951dddb1bdba..4db27f530cf13 100644 --- a/docs/fundamentals/code-analysis/includes/enabled-on-build-never.md +++ b/docs/fundamentals/code-analysis/includes/enabled-on-build-never.md @@ -1,2 +1,2 @@ > [!NOTE] -> Even if you [enable code style rules on build](../overview.md#enable-on-build), this rule is not enabled. It only surfaces in the Visual Studio editor. +> Even if you [enable code style rules on build](../overview.md#enable-on-build), this rule is not enabled. It only surfaces in the IDE. diff --git a/docs/fundamentals/code-analysis/style-rules/ide3000.md b/docs/fundamentals/code-analysis/style-rules/ide3000.md new file mode 100644 index 0000000000000..4b7ff0fb3e377 --- /dev/null +++ b/docs/fundamentals/code-analysis/style-rules/ide3000.md @@ -0,0 +1,79 @@ +--- +title: "IDE3000: Implement with Copilot" +description: "Learn about code analysis rule IDE3000: Implement with Copilot." +ms.date: 05/20/2025 +f1_keywords: +- IDE3000 +helpviewer_keywords: +- IDE3000 +dev_langs: +- CSharp +ai-usage: ai-assisted +--- + +# Implement with Copilot (IDE3000) + +| Property | Value | +|--------------------------|-------------------------------| +| **Rule ID** | IDE3000 | +| **Title** | Implement with Copilot | +| **Category** | CodeQuality | +| **Subcategory** | Miscellaneous rules | +| **Applicable languages** | C# | + +## Overview + +This rule identifies methods that contain a and provides a light bulb suggestion to implement the method using GitHub Copilot. When you use this code fix, GitHub Copilot generates an implementation for the method based on its signature, type context, and other available information. + +[!INCLUDE [enabled-on-build-never](../includes/enabled-on-build-never.md)] + +## Options + +This rule has no associated code-style options. + +## Example + +```csharp +// Code with NotImplementedException +public class Calculator +{ + public int Add(int a, int b) + { + // IDE3000: Implement with Copilot. + throw new NotImplementedException(); + } +} +``` + +When you click on the light bulb suggestion, select the **Implement with Copilot** option to prompt GitHub Copilot to generate an implementation for the method. + +## Suppress a warning + +If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. + +```csharp +#pragma warning disable IDE3000 +// The code that's violating the rule is on this line. +#pragma warning restore IDE3000 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.IDE3000.severity = none +``` + +To disable all of the code-style rules, set the severity for the category `Style` to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_analyzer_diagnostic.category-Style.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). + +## See also + +- [Generate unit tests with GitHub Copilot](../../../core/testing/unit-testing-with-copilot.md) +- [Code style rules reference](index.md) diff --git a/docs/fundamentals/code-analysis/style-rules/index.md b/docs/fundamentals/code-analysis/style-rules/index.md index adc1758116ae2..6216dece4ddfa 100644 --- a/docs/fundamentals/code-analysis/style-rules/index.md +++ b/docs/fundamentals/code-analysis/style-rules/index.md @@ -1,7 +1,7 @@ --- title: Code-style rules overview description: Learn about the different .NET code-style rules and categories. -ms.date: 03/25/2025 +ms.date: 05/20/2025 author: gewarren ms.author: gewarren --- @@ -148,6 +148,7 @@ The following table list all the code-style rules by ID and [options](../code-st > | [IDE0350](ide0350.md) | Use implicitly typed lambda | [csharp_style_prefer_implicitly_typed_lambda_expression](ide0350.md#csharp_style_prefer_implicitly_typed_lambda_expression) | > | [IDE1005](ide1005.md) | Use conditional delegate call | [csharp_style_conditional_delegate_call](ide1005.md#csharp_style_conditional_delegate_call) | > | [IDE1006](naming-rules.md) | Naming styles | | +> | [IDE3000](ide3000.md) | Implement with Copilot | | > [!NOTE] > There are some rules that only surface in the Visual Studio IDE, and these regard JSON and regular expression pattern strings. For more information, see [JSON001](/visualstudio/ide/reference/json001), [JSON002](/visualstudio/ide/reference/json002), and [RE0001](/visualstudio/ide/reference/re0001). diff --git a/docs/fundamentals/code-analysis/style-rules/miscellaneous-rules.md b/docs/fundamentals/code-analysis/style-rules/miscellaneous-rules.md index 80a94fa8dcb6e..b64a97732a875 100644 --- a/docs/fundamentals/code-analysis/style-rules/miscellaneous-rules.md +++ b/docs/fundamentals/code-analysis/style-rules/miscellaneous-rules.md @@ -11,6 +11,7 @@ This section contains code-style rules that don't fit in any other category. The - [Remove invalid global 'SuppressMessageAttribute' (IDE0076)](ide0076.md) - [Avoid legacy format target in global 'SuppressMessageAttribute' (IDE0077)](ide0077.md) +- [Implement with Copilot (IDE3000)](ide3000.md) ## See also diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index 8f20bbccb3c04..bbef7e7fbb8e2 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -1697,6 +1697,8 @@ items: href: ../../fundamentals/code-analysis/style-rules/ide0076.md - name: IDE0077 href: ../../fundamentals/code-analysis/style-rules/ide0077.md + - name: IDE3000 + href: ../../fundamentals/code-analysis/style-rules/ide3000.md - name: Formatting rules items: - name: IDE0055