diff --git a/Sources/SwiftLanguageService/CodeActions/ConvertJSONToCodableStruct.swift b/Sources/SwiftLanguageService/CodeActions/ConvertJSONToCodableStruct.swift index 99d3fa0b..69a1eb2a 100644 --- a/Sources/SwiftLanguageService/CodeActions/ConvertJSONToCodableStruct.swift +++ b/Sources/SwiftLanguageService/CodeActions/ConvertJSONToCodableStruct.swift @@ -110,9 +110,10 @@ package struct ConvertJSONToCodableStruct: EditRefactoringProvider { let baseIndentation = getBaseIndentation(from: jsonNode) let format = BasicFormat(indentationWidth: indentation, initialIndentation: baseIndentation) - let indentedDecls = topLevelObject.asDeclSyntax(name: "JSONValue") + var formattedDecls = topLevelObject.asDeclSyntax(name: "JSONValue") .formatted(using: format) - .description + formattedDecls.leadingTrivia = [] + let indentedDecls = formattedDecls.description // Render the change into a set of source edits. switch preflight { diff --git a/Tests/SourceKitLSPTests/SyntaxRefactorTests.swift b/Tests/SourceKitLSPTests/SyntaxRefactorTests.swift index 637cdeac..80c49b02 100644 --- a/Tests/SourceKitLSPTests/SyntaxRefactorTests.swift +++ b/Tests/SourceKitLSPTests/SyntaxRefactorTests.swift @@ -202,22 +202,22 @@ final class SyntaxRefactorTests: SourceKitLSPTestCase { range: AbsolutePosition(utf8Offset: 0)..(