|
| 1 | +--- |
| 2 | +title: "IDE3000: Implement method with Copilot" |
| 3 | +description: "Learn about code analysis rule IDE3000: Implement method with Copilot." |
| 4 | +ms.date: 05/20/2024 |
| 5 | +f1_keywords: |
| 6 | +- IDE3000 |
| 7 | +helpviewer_keywords: |
| 8 | +- IDE3000 |
| 9 | +dev_langs: |
| 10 | +- CSharp |
| 11 | +--- |
| 12 | + |
| 13 | +# Implement method with Copilot (IDE3000) |
| 14 | + |
| 15 | +| Property | Value | |
| 16 | +|--------------------------|-----------------------------------------------| |
| 17 | +| **Rule ID** | IDE3000 | |
| 18 | +| **Title** | Implement method with Copilot | |
| 19 | +| **Category** | Style | |
| 20 | +| **Subcategory** | Code refactoring | |
| 21 | +| **Applicable languages** | C# | |
| 22 | + |
| 23 | +## Overview |
| 24 | + |
| 25 | +This rule identifies methods that contain a `NotImplementedException` 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. |
| 26 | + |
| 27 | +[!INCLUDE [enabled-on-build-never](../includes/enabled-on-build-never.md)] |
| 28 | + |
| 29 | +## Options |
| 30 | + |
| 31 | +This rule has no associated code-style options. |
| 32 | + |
| 33 | +## Example |
| 34 | + |
| 35 | +```csharp |
| 36 | +// Code with NotImplementedException |
| 37 | +public class Calculator |
| 38 | +{ |
| 39 | + public int Add(int a, int b) |
| 40 | + { |
| 41 | + throw new NotImplementedException(); // IDE3000: Implement method with Copilot |
| 42 | + } |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +When you encounter a `NotImplementedException` in your code, the IDE shows a light bulb suggestion. When you click on it, you'll see the "Implement using Copilot" option. Selecting this option prompts GitHub Copilot to generate an implementation for the method. |
| 47 | + |
| 48 | +## Suppress a warning |
| 49 | + |
| 50 | +If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. |
| 51 | + |
| 52 | +```csharp |
| 53 | +#pragma warning disable IDE3000 |
| 54 | +// The code that's violating the rule is on this line. |
| 55 | +#pragma warning restore IDE3000 |
| 56 | +``` |
| 57 | + |
| 58 | +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). |
| 59 | + |
| 60 | +```ini |
| 61 | +[*.{cs,vb}] |
| 62 | +dotnet_diagnostic.IDE3000.severity = none |
| 63 | +``` |
| 64 | + |
| 65 | +To disable all of the code-style rules, set the severity for the category `Style` to `none` in the [configuration file](../configuration-files.md). |
| 66 | + |
| 67 | +```ini |
| 68 | +[*.{cs,vb}] |
| 69 | +dotnet_analyzer_diagnostic.category-Style.severity = none |
| 70 | +``` |
| 71 | + |
| 72 | +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). |
| 73 | + |
| 74 | +## See also |
| 75 | + |
| 76 | +- [Generate unit tests with GitHub Copilot](../../../core/testing/unit-testing-with-copilot.md) |
| 77 | +- [Code style rules reference](index.md) |
0 commit comments