Skip to content

Commit 706087a

Browse files
committed
Exclude expected completions for underscored attributes
Don't check completions for e.g `@_spi` or its arguments.
1 parent 87ca387 commit 706087a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

SourceKitStressTester/Sources/StressTester/ActionGenerators.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,31 @@ private struct ActionToken {
529529
}
530530
}
531531

532+
// Avoid matching for underscored attributes since we hide completions for
533+
// those.
534+
do {
535+
var parent = parent
536+
if let label = parent.as(LabeledExprSyntax.self),
537+
let labelParent = label.parent, label.label == token {
538+
parent = labelParent
539+
} else if let nextParent = parent.parent {
540+
parent = nextParent
541+
if let label = parent.as(LabeledExprSyntax.self),
542+
let labelParent = label.parent {
543+
parent = labelParent
544+
}
545+
}
546+
if let exprList = parent.as(LabeledExprListSyntax.self),
547+
let listParent = exprList.parent {
548+
parent = listParent
549+
}
550+
if let attr = parent.as(AttributeSyntax.self),
551+
let ident = attr.attributeName.as(IdentifierTypeSyntax.self),
552+
ident.name.text.hasPrefix("_") {
553+
return nil
554+
}
555+
}
556+
532557
let result = expectedResultImpl(for: token, parent: parent)
533558

534559
// If the argument labels are passing along `file` and `line` arguments,

0 commit comments

Comments
 (0)