Skip to content

Migrate to SwiftExtensions API in swift-tools-protocols#2686

Merged
rintaro merged 1 commit into
swiftlang:mainfrom
rintaro:delete-duplicate-swiftextensions
Jun 10, 2026
Merged

Migrate to SwiftExtensions API in swift-tools-protocols#2686
rintaro merged 1 commit into
swiftlang:mainfrom
rintaro:delete-duplicate-swiftextensions

Conversation

@rintaro

@rintaro rintaro commented Jun 3, 2026

Copy link
Copy Markdown
Member

Update for swiftlang/swift-tools-protocols#65

Delete duplicated implementations from SwiftExtensions. The same APIs now live in swift-tools-protocols as @_spi(SourceKitLSP) public declarations.

@rintaro rintaro force-pushed the delete-duplicate-swiftextensions branch 2 times, most recently from 4bfe120 to 3f10a02 Compare June 3, 2026 23:20
@rintaro

rintaro commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test

@rintaro

rintaro commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test Windows

1 similar comment
@rintaro

rintaro commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test Windows

@rintaro rintaro force-pushed the delete-duplicate-swiftextensions branch from 3f10a02 to 1a99032 Compare June 4, 2026 16:46
@rintaro

rintaro commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test

@rintaro

rintaro commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test Windows

2 similar comments
@rintaro

rintaro commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test Windows

@rintaro

rintaro commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test Windows

@rintaro

rintaro commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test

return Double(self.components.attoseconds) / 1_000_000_000_000_000_000 + Double(self.components.seconds)
}
}
@_exported @_spi(SourceKitLSP) public import ToolsProtocolsSwiftExtensions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to use @_exported? Re-exporting symbols always feels a bit like a hack to me and it’s not really needed here. We could just import ToolsProtocolsSwiftExtensions wherever it’s used.

@rintaro rintaro Jun 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to use @_exported?

Not "really", but IMO adding @_spi(SourceKitLSP) import ToolsProtocolsSwiftExtensions everywhere doesn't benefit anything.
By @_exported (the second commit) We can save 93 (+124 -217) lines of code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main thought is just that once we start with @_exported, where do we stop. Surely we can remove a bunch of imports if we make SourceKitLSP export SwiftExtensions as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, removed the second commit 👍

@rintaro rintaro force-pushed the delete-duplicate-swiftextensions branch from 1a99032 to fd9fd7a Compare June 8, 2026 21:51
Delete `Collection+Only.swift`, `Duration+Seconds.swift`,
`FileManagerExtensions.swift`, `PipeAsStringHandler.swift`, and
`URLExtensions.swift` from `Sources/SwiftExtensions/`. The same
APIs now live in swift-tools-protocols as `@_spi(SourceKitLSP)
public` declarations.

Update each call site to add `@_spi(SourceKitLSP) import
ToolsProtocolsSwiftExtensions` next to the existing
`import SwiftExtensions`. Add the
`_ToolsProtocolsSwiftExtensionsForPlugin` dependency and the
`ToolsProtocolsSwiftExtensions=_ToolsProtocolsSwiftExtensionsForPlugin`
module alias to the `SwiftSourceKitClientPlugin` target in both
`Package.swift` and the corresponding `CMakeLists.txt`.
@rintaro rintaro force-pushed the delete-duplicate-swiftextensions branch from fd9fd7a to b9e4c67 Compare June 9, 2026 04:08
@rintaro

rintaro commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test

@rintaro

rintaro commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

swiftlang/swift-tools-protocols#65
@swift-ci Please test Windows

@rintaro rintaro merged commit a526522 into swiftlang:main Jun 10, 2026
3 checks passed
@rintaro rintaro deleted the delete-duplicate-swiftextensions branch June 10, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants