|
5 | 5 | #nullable disable |
6 | 6 |
|
7 | 7 | using System; |
8 | | -using System.Collections.Generic; |
9 | 8 | using System.Collections.Immutable; |
10 | 9 | using System.Composition; |
11 | 10 | using System.Threading; |
12 | 11 | using Microsoft.CodeAnalysis; |
| 12 | +using Microsoft.CodeAnalysis.CSharp.CodeGeneration; |
13 | 13 | using Microsoft.CodeAnalysis.CSharp.Extensions; |
| 14 | +using Microsoft.CodeAnalysis.CSharp.Formatting; |
14 | 15 | using Microsoft.CodeAnalysis.CSharp.Syntax; |
15 | 16 | using Microsoft.CodeAnalysis.Editing; |
| 17 | +using Microsoft.CodeAnalysis.Formatting; |
16 | 18 | using Microsoft.CodeAnalysis.Host.Mef; |
17 | 19 | using Microsoft.CodeAnalysis.ImplementInterface; |
18 | 20 | using Microsoft.CodeAnalysis.Shared.Extensions; |
19 | 21 |
|
20 | 22 | namespace Microsoft.CodeAnalysis.CSharp.ImplementInterface; |
21 | 23 |
|
22 | 24 | [ExportLanguageService(typeof(IImplementInterfaceService), LanguageNames.CSharp), Shared] |
23 | | -internal class CSharpImplementInterfaceService : AbstractImplementInterfaceService |
| 25 | +[method: ImportingConstructor] |
| 26 | +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] |
| 27 | +internal sealed class CSharpImplementInterfaceService() : AbstractImplementInterfaceService |
24 | 28 | { |
25 | | - [ImportingConstructor] |
26 | | - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] |
27 | | - public CSharpImplementInterfaceService() |
28 | | - { |
29 | | - } |
| 29 | + protected override ISyntaxFormatting SyntaxFormatting |
| 30 | + => CSharpSyntaxFormatting.Instance; |
| 31 | + |
| 32 | + protected override SyntaxGeneratorInternal SyntaxGeneratorInternal |
| 33 | + => CSharpSyntaxGeneratorInternal.Instance; |
30 | 34 |
|
31 | 35 | protected override string ToDisplayString(IMethodSymbol disposeImplMethod, SymbolDisplayFormat format) |
32 | 36 | => SymbolDisplay.ToDisplayString(disposeImplMethod, format); |
@@ -90,16 +94,16 @@ protected override SyntaxNode CreateFinalizer( |
90 | 94 | { |
91 | 95 | // ' Do not change this code... |
92 | 96 | // Dispose(false) |
93 | | - var disposeStatement = (StatementSyntax)AddComment(g, |
94 | | - string.Format(FeaturesResources.Do_not_change_this_code_Put_cleanup_code_in_0_method, disposeMethodDisplayString), |
| 97 | + var disposeStatement = (StatementSyntax)AddComment( |
| 98 | + string.Format(CodeFixesResources.Do_not_change_this_code_Put_cleanup_code_in_0_method, disposeMethodDisplayString), |
95 | 99 | g.ExpressionStatement(g.InvocationExpression( |
96 | 100 | g.IdentifierName(nameof(IDisposable.Dispose)), |
97 | 101 | g.Argument(DisposingName, RefKind.None, g.FalseLiteralExpression())))); |
98 | 102 |
|
99 | 103 | var methodDecl = SyntaxFactory.DestructorDeclaration(classType.Name).AddBodyStatements(disposeStatement); |
100 | 104 |
|
101 | | - return AddComment(g, |
102 | | - string.Format(FeaturesResources.TODO_colon_override_finalizer_only_if_0_has_code_to_free_unmanaged_resources, disposeMethodDisplayString), |
| 105 | + return AddComment( |
| 106 | + string.Format(CodeFixesResources.TODO_colon_override_finalizer_only_if_0_has_code_to_free_unmanaged_resources, disposeMethodDisplayString), |
103 | 107 | methodDecl); |
104 | 108 | } |
105 | 109 | } |
0 commit comments