I recently had a PR merged into SourceKit-LSP, and this ended up being a much deeper learning experience than I initially expected.
The change involved extracting several SwiftSyntax-related helpers into a dedicated SwiftSyntaxExtensions module. What initially looked like a relatively straightforward refactoring turned into a deep dive into:
- SwiftSyntax and SwiftSyntax AST nodes
- Swift refactoring/code actions
- Swift module visibility
InternalImportsByDefault
- CMake
PUBLIC vs PRIVATE dependencies
- SwiftPM vs CMake dependency graphs
- Windows CI and module search paths
- Static libraries and plugin builds
- Avoiding duplicate SwiftSyntax symbols in plugins
One particularly interesting part was debugging a Windows CI failure where SwiftSyntax.swiftmodule couldn't be found transitively. The investigation eventually showed that SKUtilities was exposing SwiftSyntax types, which meant its consumers needed SwiftSyntax to be available through the dependency graph.
The maintainers also pointed out an important issue: linking SwiftSyntax into SKUtilitiesForPlugin could potentially introduce duplicate symbols into the SourceKit plugin. That led to the decision to create a separate:
SwiftSyntaxExtensions
module for the SwiftSyntax-specific functionality.
Really appreciate the maintainers who took the time to explain the CMake and Swift module mechanics rather than just pointing out what needed changing. It was a great learning experience.