Skip to content

Improve comment of leading and trailing trivia on SyntaxProtocol #2304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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