File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -471,6 +471,12 @@ public extension SyntaxProtocol {
471
471
/// The leading trivia of this syntax node. Leading trivia is attached to
472
472
/// the first token syntax contained by this node. Without such token, this
473
473
/// property will return nil.
474
+ ///
475
+ /// Note: `Trivia` is not able to represent invalid UTF-8 sequences. To get
476
+ /// the leading trivia text including all invalid UTF-8 sequences, use
477
+ /// ```
478
+ /// node.syntaxTextBytes.prefix(self.leadingTriviaLength.utf8Length)
479
+ /// ```
474
480
var leadingTrivia : Trivia {
475
481
get {
476
482
return raw. formLeadingTrivia ( )
@@ -483,6 +489,12 @@ public extension SyntaxProtocol {
483
489
/// The trailing trivia of this syntax node. Trailing trivia is attached to
484
490
/// the last token syntax contained by this node. Without such token, this
485
491
/// property will return nil.
492
+ ///
493
+ /// Note: `Trivia` is not able to represent invalid UTF-8 sequences. To get
494
+ /// the leading trivia text including all invalid UTF-8 sequences, use
495
+ /// ```
496
+ /// node.syntaxTextBytes[(node.byteSize - node.trailingTriviaLength.utf8Length)...]
497
+ /// ```
486
498
var trailingTrivia : Trivia {
487
499
get {
488
500
return raw. formTrailingTrivia ( )
You can’t perform that action at this time.
0 commit comments