File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
ReactiveUI.SourceGenerators.Execute
ReactiveUI.SourceGenerators/Reactive Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 8
8
using System . Reactive . Linq ;
9
9
using System . Runtime . Serialization ;
10
10
using System . Text . Json . Serialization ;
11
+ using ReactiveUI ;
12
+ using ReactiveUI . SourceGenerators ;
11
13
12
- namespace ReactiveUI . SourceGenerators . Test ;
14
+ namespace SGReactiveUI . SourceGenerators . Test ;
13
15
14
16
#pragma warning disable SA1402 // File may only contain a single type
15
17
#pragma warning disable SA1649 // File name should match first type name
Original file line number Diff line number Diff line change 6
6
using System . Collections . Immutable ;
7
7
using System . Linq ;
8
8
using Microsoft . CodeAnalysis ;
9
+ using Microsoft . CodeAnalysis . CSharp ;
9
10
using Microsoft . CodeAnalysis . CSharp . Syntax ;
10
11
using ReactiveUI . SourceGenerators . Extensions ;
11
12
using ReactiveUI . SourceGenerators . Models ;
13
+ using static Microsoft . CodeAnalysis . CSharp . SyntaxFactory ;
12
14
13
15
namespace ReactiveUI . SourceGenerators ;
14
16
@@ -67,7 +69,15 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
67
69
. ToImmutableArray ( ) ;
68
70
69
71
// Insert all members into the same partial type declaration
70
- var compilationUnit = item . Key . GetCompilationUnit ( memberDeclarations ) ;
72
+ var compilationUnit = item . Key . GetCompilationUnit ( memberDeclarations )
73
+ . WithLeadingTrivia ( TriviaList (
74
+ Comment ( "using ReactiveUI;" ) ,
75
+ CarriageReturn ,
76
+ Comment ( "// <auto-generated/>" ) ,
77
+ Trivia ( PragmaWarningDirectiveTrivia ( Token ( SyntaxKind . DisableKeyword ) , true ) ) ,
78
+ Trivia ( NullableDirectiveTrivia ( Token ( SyntaxKind . EnableKeyword ) , true ) ) ,
79
+ CarriageReturn ) )
80
+ . NormalizeWhitespace ( ) ;
71
81
context . AddSource ( $ "{ item . Key . FilenameHint } .Properties.g.cs", compilationUnit ) ;
72
82
} ) ;
73
83
}
You can’t perform that action at this time.
0 commit comments