Skip to content

Commit 25ce3a2

Browse files
authored
Merge pull request swiftlang#2519 from ahoppen/ahoppen/editor-placeholder-spi
Offer `EditorPlaceholderData` as SPI to sourcekit-lsp
2 parents 54887a8 + 68f80ce commit 25ce3a2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Sources/SwiftRefactor/ExpandEditorPlaceholder.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,21 @@ extension FunctionCallExprSyntax {
364364
/// NOTE: It is required that '##' is not a valid substring of display-string
365365
/// or type-string. If this ends up not the case for some reason, we can consider
366366
/// adding escaping for '##'.
367-
fileprivate enum EditorPlaceholderData {
367+
@_spi(SourceKitLSP)
368+
public enum EditorPlaceholderData {
368369
case basic(text: Substring)
369370
case typed(text: Substring, type: TypeSyntax)
370371

371372
init?(token: TokenSyntax) {
372-
guard isPlaceholder(token.text) else {
373+
self.init(text: token.text)
374+
}
375+
376+
@_spi(SourceKitLSP)
377+
public init?(text: String) {
378+
guard isPlaceholder(text) else {
373379
return nil
374380
}
375-
376-
var text = token.text.dropFirst(2).dropLast(2)
381+
var text = text.dropFirst(2).dropLast(2)
377382

378383
if !text.hasPrefix("T##") {
379384
// No type information

0 commit comments

Comments
 (0)