SourceEdit
A textual edit to the original source represented by a range and a replacement.
struct SourceEdit
A textual edit to the original source represented by a range and a replacement.
struct SourceEdit
import SwiftSyntax
A library for working with Swift code.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol Sendable
init(range: Range<AbsolutePosition>, replacement: String)
Create an edit to replace range
in the original source with replacement
.
static func insert(_ newText: String, after node: some SyntaxProtocol) -> SourceEdit
Convenience function to create a textual addition after the given node and its trivia.
static func insert(_ newText: String, before node: some SyntaxProtocol) -> SourceEdit
Convenience function to create a textual addition before the given node and its trivia.
static func remove(_ node: some SyntaxProtocol) -> SourceEdit
Convenience function to create a textual deletion the given node and its trivia.
static func replace(_ node: some SyntaxProtocol, with replacement: String) -> SourceEdit
Convenience function to create a textual replacement of the given node, including its trivia.
var debugDescription: String { get }
var length: SourceLength { get }
Length of the original source range that this edit applies to. Zero if this is an addition.
let range: Range<AbsolutePosition>
The half-open range that this edit applies to.
let replacement: String
The text to replace the original range with. Empty for a deletion.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.