Skip to content

Commit f541147

Browse files
committed
Add doc comment regarding useName in token parser
1 parent 4b37834 commit f541147

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/SourceKitLSP/Swift/SyntaxHighlightingToken.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ extension Array where Element == SyntaxHighlightingToken {
230230
/// Parses tokens from sourcekitd response dictionaries.
231231
struct SyntaxHighlightingTokenParser {
232232
private let sourcekitd: SourceKitD
233+
/// Use `keys.nameoffset` and `keys.namelength` instead of `keys.offset`
234+
/// and `keys.length`. This is useful in AST structures provided by
235+
/// sourcekitd, since these contain both a name range and a normal range,
236+
/// where the latter refers to the entire node (e.g. the entire function
237+
/// declaration).
233238
private let useName: Bool
234239

235240
init(sourcekitd: SourceKitD, useName: Bool = false) {

0 commit comments

Comments
 (0)