Skip to content

Commit

Permalink
Improve comment of leading and trailing trivia on SyntaxProtocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoppen committed Oct 18, 2023
1 parent ccab07f commit d5400cb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Sources/SwiftSyntax/SyntaxProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,12 @@ public extension SyntaxProtocol {
// MARK: Trivia

public extension SyntaxProtocol {
/// The leading trivia of this syntax node. Leading trivia is attached to
/// the first token syntax contained by this node. Without such token, this
/// property will return nil.
/// The leading trivia of this syntax node.
///
/// Note: ``Trivia`` is not able to represent invalid UTF-8 sequences. To get
/// Trivia is always attached to tokens, not to layout nodes. This will return the leading trivia of the first token
/// within the subtree. If no such token exists, this returns empty trivia.
///
/// - Note: ``Trivia`` is not able to represent invalid UTF-8 sequences. To get
/// the leading trivia text including all invalid UTF-8 sequences, use
/// ```
/// node.syntaxTextBytes.prefix(self.leadingTriviaLength.utf8Length)
Expand All @@ -481,9 +482,10 @@ public extension SyntaxProtocol {
}
}

/// The trailing trivia of this syntax node. Trailing trivia is attached to
/// the last token syntax contained by this node. Without such token, this
/// property will return nil.
/// The trailing trivia of this syntax node.
///
/// Trivia is always attached to tokens, not to layout nodes. This will return the trailing trivia of the last token
/// within the subtree. If no such token exists, this returns empty trivia.
///
/// Note: ``Trivia`` is not able to represent invalid UTF-8 sequences. To get
/// the leading trivia text including all invalid UTF-8 sequences, use
Expand Down

0 comments on commit d5400cb

Please sign in to comment.