Sometimes the placeholder is identified as EditorPlaceholderPattern and sometimes as EditorPlaceholderExpr
HassanTaleb90 opened this issue · 2 comments
HassanTaleb90 commented
Code:
let <#name#> = <#value#>
<#name#> // EditorPlaceholderPattern
<#value#> // EditorPlaceholderExpr
What is the difference between EditorPlaceholderPattern and EditorPlaceholderExpr?
ahoppen commented
Tracked in Apple’s issue tracker as rdar://115211644
ahoppen commented
The left-hand side of a variable declaration is a PatternSyntax
and thus the editor placeholder is parsed as an EditorPalceholderPatternSyntax
. This comes from the facto that Swift models variable declarations as pattern bindings with a pattern on the left and an expression that is being bound on the right side of the =
sign.
https://swiftpackageindex.com/apple/swift-syntax/main/documentation/swiftsyntax/patternbindingsyntax.