@@ -102,7 +102,7 @@ private async Task FormatAsync(Workspace workspace, IReadOnlyList<DocumentId> do
102
102
FormatLogger . WriteLine ( "Total time {0}" , watch . Elapsed ) ;
103
103
}
104
104
105
- internal Solution AddTablePreprocessorSymbol ( Solution solution )
105
+ private Solution AddTablePreprocessorSymbol ( Solution solution )
106
106
{
107
107
var projectIds = solution . ProjectIds ;
108
108
foreach ( var projectId in projectIds )
@@ -122,13 +122,32 @@ internal Solution AddTablePreprocessorSymbol(Solution solution)
122
122
return solution ;
123
123
}
124
124
125
+ /// <summary>
126
+ /// Remove the added table preprocessor symbol. Don't want that saved into the project
127
+ /// file as a change.
128
+ /// </summary>
129
+ private Solution RemoveTablePreprocessorSymbol ( Solution newSolution , Solution oldSolution )
130
+ {
131
+ var solution = newSolution ;
132
+ var projectIds = solution . ProjectIds ;
133
+ foreach ( var projectId in projectIds )
134
+ {
135
+ var oldProject = oldSolution . GetProject ( projectId ) ;
136
+ var newProject = newSolution . GetProject ( projectId ) ;
137
+ solution = newProject . WithParseOptions ( oldProject . ParseOptions ) . Solution ;
138
+ }
139
+
140
+ return solution ;
141
+ }
142
+
125
143
internal async Task < Solution > FormatCoreAsync ( Solution originalSolution , IReadOnlyList < DocumentId > documentIds , CancellationToken cancellationToken )
126
144
{
127
145
var solution = originalSolution ;
128
146
solution = AddTablePreprocessorSymbol ( originalSolution ) ;
129
147
solution = await RunSyntaxPass ( solution , documentIds , cancellationToken ) ;
130
148
solution = await RunLocalSemanticPass ( solution , documentIds , cancellationToken ) ;
131
149
solution = await RunGlobalSemanticPass ( solution , documentIds , cancellationToken ) ;
150
+ solution = RemoveTablePreprocessorSymbol ( solution , originalSolution ) ;
132
151
return solution ;
133
152
}
134
153
0 commit comments