swift.play in textDocument/codelens request
- New `swift.play` CodeLens support that is an experimental feature while [swift play](https://github.com/apple/swift-play-experimental/) is still experimental - Add #Playground macro visitor to parse the macro expansions - File must `import Playgrounds` to record the macro expansion - The `swift-play` binary must exist in the toolchain to - TextDocumentPlayground will record the id and optionally label to match detail you get from ``` $ swift play --list Building for debugging... Found 1 Playground * Fibonacci/Fibonacci.swift:23 "Fibonacci" ``` - Add LSP extension documentation for designing pending `workspace/playground` request - Add new parsing test cases - Update CMake files Issue: #2339 #2343 Add column to unnamed label Update Sources/SwiftLanguageService/SwiftCodeLensScanner.swift Co-authored-by: Alex Hoppen <alex@alexhoppen.de> Update Sources/SwiftLanguageService/SwiftPlaygroundsScanner.swift Co-authored-by: Alex Hoppen <alex@alexhoppen.de> Update Sources/SwiftLanguageService/SwiftPlaygroundsScanner.swift Co-authored-by: Alex Hoppen <alex@alexhoppen.de> Update Tests/SourceKitLSPTests/CodeLensTests.swift Co-authored-by: Alex Hoppen <alex@alexhoppen.de> Address review comments Fix test failures Fix more review comments Update for swift-tools-core
SourceKit-LSP
SourceKit-LSP is an implementation of the Language Server Protocol (LSP) for Swift and C-based languages. It provides intelligent editor functionality like code-completion and jump-to-definition to editors that support LSP. SourceKit-LSP is built on top of sourcekitd and clangd for high-fidelity language support, and provides a powerful source code index as well as cross-language support. SourceKit-LSP supports projects that use the Swift Package Manager and projects that generate a compile_commands.json file, such as CMake.
Getting Started
SourceKit-LSP is included in the the Swift toolchains available on swift.org and is bundled with Xcode.
swift.org/tools has a list of popular editors that support LSP and can thus be hooked up to SourceKit-LSP to provide intelligent editor functionality as well as set-up guides.
Important
SourceKit-LSP does not update its global index in the background or build Swift modules in the background. Thus, a lot of cross-module or global functionality is limited if the project hasn't been built recently. To update the index or rebuild the Swift modules, build your project or enable the experimental background indexing as described in Enable Experimental Background Indexing.
To learn more about SourceKit-LSP, refer to the Documentation.
Note
If you are using SourceKit-LSP with a SwiftPM project in which you need to pass additional arguments to the
swift buildinvocation, as is commonly the case for embedded projects, you need to teach SourceKit-LSP about those arguments as described in Using SourceKit-LSP with Embedded Projects.
Reporting Issues
If you should hit any issues while using SourceKit-LSP, we appreciate bug reports on GitHub Issue.
Contributing
If you want to contribute code to SourceKit-LSP, see CONTRIBUTING.md for more information.