Commit Graph

40 Commits

Author SHA1 Message Date
Adam Ward
927d347778 Fix spelling error in CMakelist 2025-11-11 13:48:06 -05:00
Adam Ward
2830c55fc0 Fix Swift format error 2025-11-11 13:46:02 -05:00
award999
0366a4dcbb Update Sources/SwiftLanguageService/CMakeLists.txt
Co-authored-by: Alex Hoppen <alex@alexhoppen.de>
2025-11-11 07:52:52 -05:00
Adam Ward
0f82f33f96 Use utf8 column 2025-11-10 11:14:25 -05:00
Adam Ward
ddcddded67 Support 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
2025-11-07 15:51:17 -05:00
Mishal Shah
0876b7d403 Merge pull request #2324 from owenv/owenv/adopt-swift-tools-protocols
Adopt swift-tools-protocols
2025-11-05 09:02:00 -08:00
Owen Voorhees
f04b971726 Adopt swift-tools-protocols 2025-10-31 14:11:11 -07:00
Alex Hoppen
d9295b2c93 Add a closing parenthesis to function argument completions
Fixes #782
2025-10-30 14:38:33 +01:00
Alex Hoppen
4c957506e8 Add a code action to remove unused imports in a source file
The idea is pretty simple: When `MemberImportVisibility` is enabled, we know that imports can only affect the current source file. So, we can just try and remove every single `import` declaration in the file, check if a new error occurred and if not, we can safely remove it.
2025-10-22 23:56:09 +02:00
Alex Hoppen
2ad02363a3 Show inlay hints of #if conditions at their corresponding #endif directives
Fixes #2221
2025-10-13 16:35:05 +02:00
Alex Hoppen
a6c291b84e Do not block SourceKit-LSP functionality when a build server takes long to initialize
We previously waited for the initialization response from the build server during the creation of a `Workspace` so that we could create a `SemanticIndexManager` with the index store path etc. that was returned by the `build/initialize` response. This caused all functionality (including syntactic) of SourceKit-LSP to be blocked until the build server was initialized.

Change the computation of the `SemanticIndexManager` and related types to happen in the background so that we can provide functionality that doesn’t rely on the build server immediately.

Fixes #2304
2025-09-29 13:02:08 +01:00
Alex Hoppen
95538e7de9 Migrate appendingPathComponent to appending(component:)
`appending(component:)` is the more modern API and can take multiple path components at the same time.
2025-09-23 16:57:56 +02:00
Alex Hoppen
aa7ff70042 Merge pull request #2300 from ahoppen/drop-6.1
Drop support for building with Swift 6.1
2025-09-22 14:16:39 +02:00
Alex Hoppen
c7ca73aecb Drop support for building with Swift 6.1
Swift 6.2 has been released, so we no longer need to support building and testing SourceKit-LSP using Swift 6.1
2025-09-20 16:37:24 +02:00
Ben Barham
1313ef4520 Remove SwiftPM dependency from SwiftLanguageService
This was needed for the package manifest refactorings, but they're
now provided by swift-syntax instead.
2025-09-15 19:48:46 -07:00
Alex Hoppen
37aafd35c0 Merge pull request #2287 from ahoppen/multi-line-completion-item-formatting 2025-09-10 09:43:29 +02:00
Alex Hoppen
e43c808afd Format multi-line completion items returned by sourcekitd
For closures that don’t take any inputs and that don’t produce output, sourcekitd returns a completion item that has the trailing closure already expanded. Run SwiftBasicFormat on those to enure that the placeholder for the closure’s body is properly indented.

Fixes #2285
2025-09-09 14:47:10 +02:00
Ahmed Elrefaey
a5854f4ecf Add signature help LSP request support (#2250)
Depends on https://github.com/swiftlang/swift/pull/83378

---

Adds support for the LSP signature help request.

> [!NOTE]
> As of https://github.com/swiftlang/swift/pull/83378, SourceKitD still
doesn't separate parameter documentation from the signature
documentation and thus parameters don't have their own separate
documentation. This should just work once SourceKitD implements this
functionality and we'll only need to modify the tests.
2025-09-05 14:52:56 +01:00
Ahmed Elrefaey
1982798b5d Fetch full documentation in code completion (#2207)
When resolving documentation for code completion items, we fetch full
documentation through the newly added
`swiftide_completion_item_get_doc_full_copy` SourceKitD function, if not
found we fallback to brief documentation as before using
`swiftide_completion_item_get_doc_brief`.

> [!NOTE]
> Unlike brief documentation, SourceKitD doesn't cache full
documentation for completion results to avoid bloating memory with a lot
of large strings.
>
> As of now, SourceKit-LSP doesn't cache completion item documentation
either, should we introduce a new full documentation cache (e.g. using
`LRUCache`)?
2025-09-04 19:42:37 +01:00
Alex Hoppen
47ca76bb32 Merge pull request #2226 from matthewbastien/docc-cache-snapshots
[DocC Live Preview] Cache on-disk snapshots opened in sourcekitd
2025-08-27 23:30:42 +02:00
Ben Barham
17d260507a Merge pull request #2262 from xedin/adopt-refactoring-actions-to-use-edit-provider
[SwiftLanguageService] Adopt changes to package manifest refactoring …
2025-08-27 13:30:03 -07:00
Matthew Bastien
58096eb822 cache snapshots opened in sourcekitd by textDocument/doccDocumentation requests 2025-08-27 15:30:50 +02:00
Pavel Yaskevich
061c7a094b [SwiftLanguageService] CodeActions: Use asWorkspaceEdit in more places 2025-08-26 14:04:36 -07:00
Pavel Yaskevich
0594744a93 [SwiftLanguageService] Adopt changes to package manifest refactoring actions
Previously package manifest refactoring actions conformed to a custom
refactoring provider and produced a `PackageEdit` that, in addition to
manifest file changes, included a list of auxiliary files. This is no
longer the case and all package manifest refactoring actions are now
responsible only for manifest file transformations, the rest is handled
separately.
2025-08-26 13:00:00 -07:00
Alex Hoppen
4040a5e4ac Add default implementations to LanguageService for methods that are not expected to be implemented by all language services
With the introduction of secondary language services, we don’t expect every language service to implement every request anymore. To simplify the addition of language services like `DocumentationLanguageService` add default implementations for methods that satisfy the following criteria:
 - `SourceKitLSPServer` does not expect side effects to happen when they are called
 - The method can throw or there is a reasonable default value
 - It is reasonable to expect that not all language services need to implement it
2025-08-26 16:10:36 +02:00
Pavel Yaskevich
3274349b61 Merge pull request #2251 from xedin/throwing-refactoring-actions
[SwiftLanguageService] Adopt to throwing refactoring actions
2025-08-26 00:06:38 -07:00
Alex Hoppen
aa6301ba96 Merge pull request #2249 from ahoppen/merge-docc
Merge `DocumentationLanguageService` and `DocCDocumentation` modules
2025-08-25 14:39:18 +02:00
Pavel Yaskevich
28ec028ef5 [SwiftLanguageService] Adopt to throwing refactoring actions
`EditRefactoringProvider.textRefactor` and `EditRefactoringProvider.refactor`
requirements are now throwing and produce a non-optional type.
2025-08-22 23:27:39 -07:00
Alex Hoppen
64fe439f24 Make DocumentationLanguageService the only module that imports DocCDocumentation 2025-08-21 10:10:54 +02:00
Alex Hoppen
c1a8301b1f Merge pull request #2233 from aelam/fix/group_of_module_definition
Fix module definition jumping in Swift interface files
2025-08-20 19:05:37 +02:00
Alex Hoppen
1ca9780cd7 Merge pull request #2248 from ahoppen/lang-service-init-not-failable
Make `LanguageService` initializer non-failable
2025-08-20 06:51:27 +02:00
Alex Hoppen
08faa197af Make LanguageService initializer non-failable 2025-08-20 00:21:45 +02:00
Alex Hoppen
22fae21153 Handle documentation requests for Swift files in DocumentationLanguageService
This cleanly separates the responsibilities for handling documentation from those of handling Swift files. It also simplifies providing docc support for clang because we just need to implement the two `symbolGraph` methods in `ClangLanguageService` and can re-use the remaining infrastructure from `DoccLanguageService`.
2025-08-20 00:20:27 +02:00
Wang Lun
a86ed02a11 fixed format issue, path of interface file 2025-08-19 11:49:03 +09:00
Alex Hoppen
10c89910cc Merge pull request #2242 from ahoppen/move-docc-service 2025-08-18 07:30:33 +02:00
Alex Hoppen
615dead31c Remove a couple references to DocCDocumentation 2025-08-17 22:22:47 +02:00
Pavel Yaskevich
1aba707bb6 [cmake] Remove unused dependency on PackageModel library
Neither `ToolchainRegistry` nor `SwiftLanguageService` are using
this dependency.
2025-08-15 00:17:16 -07:00
Pavel Yaskevich
c1398b48ba [cmake] Remove dependency on PackageModelSyntax library
This is a follow-up to https://github.com/swiftlang/sourcekit-lsp/pull/2235.

The change removed uses of `PackageModelSyntax` but left is in
`target_link_libraries` of `SourceKitLSP`.
2025-08-14 13:04:42 -07:00
Wang Lun
12135d0687 fixed group of module can't navi, interface name strategy 2025-08-15 01:30:10 +09:00
Alex Hoppen
c14f5dd7fd Move SwiftLanguageService into its own module 2025-08-14 11:12:31 +02:00