Skip to content

Commit e396a0d

Browse files
Copilotgewarren
andcommitted
Add documentation for IDE3000 (Implement method with Copilot)
Co-authored-by: gewarren <[email protected]>
1 parent c66fbb3 commit e396a0d

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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)

docs/fundamentals/code-analysis/style-rules/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ The following table list all the code-style rules by ID and [options](../code-st
136136
> | [IDE0280](ide0280.md) | Use `nameof` | |
137137
> | [IDE0290](ide0290.md) | Use primary constructor | [csharp_style_prefer_primary_constructors](ide0290.md#csharp_style_prefer_primary_constructors) |
138138
> | [IDE0300](ide0300.md) | Use collection expression for array | [dotnet_style_prefer_collection_expression](ide0300.md#dotnet_style_prefer_collection_expression) |
139+
> | [IDE3000](ide3000.md) | Implement method with Copilot | |
139140
> | [IDE0301](ide0301.md) | Use collection expression for empty | [dotnet_style_prefer_collection_expression](ide0301.md#dotnet_style_prefer_collection_expression) |
140141
> | [IDE0302](ide0302.md) | Use collection expression for stackalloc | [dotnet_style_prefer_collection_expression](ide0302.md#dotnet_style_prefer_collection_expression) |
141142
> | [IDE0303](ide0303.md) | Use collection expression for `Create()` | [dotnet_style_prefer_collection_expression](ide0303.md#dotnet_style_prefer_collection_expression) |

docs/fundamentals/code-analysis/style-rules/miscellaneous-rules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This section contains code-style rules that don't fit in any other category. The
1111

1212
- [Remove invalid global 'SuppressMessageAttribute' (IDE0076)](ide0076.md)
1313
- [Avoid legacy format target in global 'SuppressMessageAttribute' (IDE0077)](ide0077.md)
14+
- [Implement method with Copilot (IDE3000)](ide3000.md)
1415

1516
## See also
1617

0 commit comments

Comments
 (0)