@@ -125,7 +125,7 @@ private async Task<Document> AddNewDocumentWithSingleTypeDeclarationAsync(Docume
125
125
// attributes from the containing partial types. We don't want to create
126
126
// duplicate attributes on things.
127
127
AddPartialModifiersToTypeChain (
128
- documentEditor , removeAttributesAndComments : true , removeTypeInheritance : true ) ;
128
+ documentEditor , removeAttributesAndComments : true , removeTypeInheritance : true , removePrimaryConstructor : true ) ;
129
129
130
130
// remove things that are not being moved, from the forked document.
131
131
var membersToRemove = GetMembersToRemove ( root ) ;
@@ -193,7 +193,7 @@ private async Task<Solution> RemoveTypeFromSourceDocumentAsync(Document sourceDo
193
193
// However, keep all the attributes on these types as theses are the
194
194
// original attributes and we don't want to mess with them.
195
195
AddPartialModifiersToTypeChain ( documentEditor ,
196
- removeAttributesAndComments : false , removeTypeInheritance : false ) ;
196
+ removeAttributesAndComments : false , removeTypeInheritance : false , removePrimaryConstructor : false ) ;
197
197
documentEditor . RemoveNode ( State . TypeNode , SyntaxRemoveOptions . KeepUnbalancedDirectives ) ;
198
198
199
199
var updatedDocument = documentEditor . GetChangedDocument ( ) ;
@@ -258,7 +258,8 @@ TMemberDeclarationSyntax or
258
258
private void AddPartialModifiersToTypeChain (
259
259
DocumentEditor documentEditor ,
260
260
bool removeAttributesAndComments ,
261
- bool removeTypeInheritance )
261
+ bool removeTypeInheritance ,
262
+ bool removePrimaryConstructor )
262
263
{
263
264
var semanticFacts = State . SemanticDocument . Document . GetRequiredLanguageService < ISemanticFactsService > ( ) ;
264
265
var typeChain = State . TypeNode . Ancestors ( ) . OfType < TTypeDeclarationSyntax > ( ) ;
@@ -283,6 +284,11 @@ private void AddPartialModifiersToTypeChain(
283
284
{
284
285
documentEditor . RemoveAllTypeInheritance ( node ) ;
285
286
}
287
+
288
+ if ( removePrimaryConstructor )
289
+ {
290
+ documentEditor . RemovePrimaryConstructor ( node ) ;
291
+ }
286
292
}
287
293
288
294
documentEditor . ReplaceNode ( State . TypeNode ,
0 commit comments