Commit Graph

2569 Commits

Author SHA1 Message Date
Alex Hoppen
024efc2fa1 Remove dependency from SourceKitLSP on swift-docc-symbolkit
This way all dependencies on the `docc` libraries are wrapped inside the `DocCDocumentation` module.
2025-04-23 18:54:45 +02:00
Alex Hoppen
bbbc93ea01 Refactor cursorInfoFromDisk to share the underlying logic of invoking cursor info 2025-04-23 18:54:42 +02:00
Matthew Bastien
4fb5323bd4 add cursorInfoFromDisk() to SwiftLanguageService 2025-04-22 15:14:36 -04:00
Matthew Bastien
3610593a00 remove closeDocument(uri:) from TestSourceKitLSPClient 2025-04-17 13:46:03 -04:00
Matthew Bastien
2ae2e709b3 add LRUCache struct to SKUtilities 2025-04-17 13:46:01 -04:00
Matthew Bastien
c24f92d73e add documentation for certain functions 2025-04-16 15:13:04 -04:00
Matthew Bastien
c37c596562 fix newline matching 2025-04-16 14:54:55 -04:00
Matthew Bastien
131c8113d5 add logging to SwiftLanguageService.doccDocumentation(_:) 2025-04-16 14:54:55 -04:00
Matthew Bastien
1c65bda727 remove some nesting levels in DocumentationLanguageService.doccDocumentation(_:) 2025-04-16 14:54:55 -04:00
Matthew Bastien
9cdd1ac517 simplify logic for CheckedIndex.primaryDefinitionOrDeclarationOccurrence(ofDocCSymbolLink:) 2025-04-16 14:44:14 -04:00
Matthew Bastien
01517746ec simplify logic for DocCSymbolInformation.matches(_:) 2025-04-16 14:44:13 -04:00
Matthew Bastien
1de68c5298 add logging to DocCReferenceResolutionService 2025-04-16 14:44:13 -04:00
Matthew Bastien
f77e323ad6 update invalidation logic for DocC catalogs 2025-04-16 14:44:13 -04:00
Matthew Bastien
b9e93f7551 add logging of failure cases to DocCCatalogIndexManager 2025-04-16 14:44:13 -04:00
Matthew Bastien
c1895c3b9f add logging to BuildSystemIntegrationExtensions 2025-04-16 14:44:13 -04:00
Matthew Bastien
0e05bca76c remove isHeader from SourceKitSourceItemData 2025-04-16 14:44:13 -04:00
Matthew Bastien
0ea0e00c55 use LinkCompletionTools to parse SwiftDocC symbol links 2025-04-16 14:44:13 -04:00
Matthew Bastien
4e06c36c70 organize imports 2025-04-16 14:44:13 -04:00
Matthew Bastien
8c15e27959 use a helper document in cursorInfo() 2025-04-16 14:44:12 -04:00
Matthew Bastien
909e63961e add missing copyright header 2025-04-16 14:44:12 -04:00
Matthew Bastien
f6f1cb33ea remove public access modifiers from package symbols 2025-04-16 14:44:12 -04:00
Matthew Bastien
1ca1441054 fix some review comments 2025-04-16 14:44:12 -04:00
Matthew Bastien
0adaf2581f more robust searching for DocC catalogs 2025-04-16 14:44:12 -04:00
Matthew Bastien
a8eae3c6d8 remove protocols from DocCDocumentation module 2025-04-16 14:44:12 -04:00
Matthew Bastien
c1a6e65efd add CMake build to DocCDocumentation module 2025-04-16 14:44:11 -04:00
Matthew Bastien
49b3f531eb move SwiftDocC related functionality into its own module 2025-04-16 14:44:11 -04:00
Matthew Bastien
24118ebc78 cleanup unused code 2025-04-16 14:44:11 -04:00
Matthew Bastien
39bf4852b0 handle Markdown and Tutorial files in textDocument/doccDocumentation 2025-04-16 14:44:11 -04:00
Alex Hoppen
6a8ea4cd97 Merge pull request #2105 from ahoppen/test-timeout-cancellation
Fix issue that caused request cancellation after a timeout in tests to not work
2025-04-09 15:23:28 -07:00
Alex Hoppen
af2767703e Merge pull request #2106 from ahoppen/require-61
Require Swift 6.1 to build SourceKit-LSP
2025-04-09 13:20:10 -07:00
Alex Hoppen
705ae0d699 Require Swift 6.1 to build SourceKit-LSP
Now that Swift 6.1 has been released, we no longer need to support building SourceKit-LSP using Swift 6.1.
2025-04-08 16:09:16 -07:00
Alex Hoppen
161eea30f0 Merge pull request #2095 from bripeticca/swiftpmapi/fiximport
Update import on SwiftPM PackageModel for `SwiftPMBuildSystem.swift`
2025-04-08 12:03:04 -07:00
Alex Hoppen
c04518241d Fix issue that caused request cancellation after a timeout in tests to not work
We were calling `server.handle(notification:)`, which called directly into `SourceKitLSPServer` but request handling is implemented in `QueueBasedMessageHandler.handle(_:)`. Call that to ensure that we actually cancel requests after the test timeout.
2025-04-07 18:28:41 -07:00
Alex Hoppen
254b42a406 Merge pull request #2098 from ahoppen/swift-format-crashing
Don’t crash SourceKit-LSP if swift-format crashes while we write the source file to stdin
2025-03-28 14:17:51 -07:00
Alex Hoppen
24f361cda2 Merge pull request #2093 from ahoppen/remove-dynamically-loaded-sourcekitd
Remove the split between `SourceKitD` and `DynamicallyLoadedSourceKitD`
2025-03-28 14:17:27 -07:00
Alex Hoppen
db981d9141 Merge pull request #2097 from ahoppen/request-handling-in-order
Fix a race condition leading to out-of-order notifications in tests
2025-03-28 09:10:12 -07:00
Alex Hoppen
f3daf21802 Don’t crash SourceKit-LSP if swift-format crashes while we write the source file to stdin
When swift-format crashes before we send all data to its stdin, we get a SIGPIPE when trying to write more data to its studio on Linux. This, in turn, takes SourceKit-LSP down.

Do the same trick that we do when launching `JSONRPCConnection` of disabling SIGPIPE globally if we can’t disable it for individual pipes.

rdar://147665695
2025-03-27 21:47:33 -07:00
Alex Hoppen
a151ca413c Fix a race condition leading to out-of-order notifications in tests
`TestSourceKitLSPClient.handle` created a new `Task`. This means that we could swap the order of notifications received from SourceKit-LSP. In most cases this doesn’t matter but `BackgroundIndexingTests.testProduceIndexLogWithTaskID` checks that the notification to start a structured log is received before the first report, which might not be the case because of the `Task` here.

Change `PendingNotifications` to a class with a `ThreadSafeBox` to remove the need for a `Task`.

rdar://147814254
2025-03-27 15:15:11 -07:00
Alex Hoppen
250081ec58 Fix theoretical issue in withTaskPriorityChangedHandler that could always report a priority change to high
We were launching the task that watches for the priority change with `high` priority. If the base priority was `medium`, this should immediately report a priority change to `high`. It appears the only reason why this doesn’t happen right now is due to rdar://147868544.
2025-03-27 15:07:45 -07:00
Alex Hoppen
374554bde7 Merge pull request #2092 from ahoppen/official-synchronization
Make `workspace/synchronize` a non-experimental request
2025-03-27 15:05:22 -07:00
Alex Hoppen
3fb72cddb6 Merge pull request #2089 from ahoppen/async-fixes
Be a little more pedantic about making sure that we cancel  `bodyTask` and `timeoutTask` in `withTimeout` and `withTaskPriorityChangedHandler`
2025-03-27 15:04:03 -07:00
Alex Hoppen
93d59cbe18 Merge pull request #2091 from ahoppen/time-imprecise
Add delay before writing file to disk in tests
2025-03-27 15:03:51 -07:00
Bri Peticca
41fe2a52b3 Update import for PackageModel
With upcoming changes to SwiftPM's TraitConfiguration
(see #8370), PackageModel needs to be imported using
`@preconcurrency`.
2025-03-27 14:42:58 -04:00
Alex Hoppen
53407f59af Mark asynchronous blocks in Csourcekitd as Sendable
We don’t have any guarantees which thread these blocks will be called on by sourcekitd, so we shouldn’t make any assumptions about it in Swift. We should thus mark them as Sendable.
2025-03-27 11:06:49 -07:00
Alex Hoppen
5882eae734 Merge SourceKitD.swift and DynamicallyLoadedSourceKitD.swift
With the merge of `SourceKitD` and `DynamicallyLoadedSourceKitD`, there is no longer a need to have two files.
2025-03-27 11:06:48 -07:00
Alex Hoppen
92aa94fa43 Remove the split between SourceKitD and DynamicallyLoadedSourceKitD
There is only one real class that implements the `SourceKitD` protocol, so there really isn’t any need for the protocol + class split at all. Unify them to make code simpler to reason about.
2025-03-27 11:05:24 -07:00
Alex Hoppen
e474354bca Merge pull request #2051 from ahoppen/build-graph-generation
Don't wait for build graph generation when file is changed
2025-03-26 14:40:06 -07:00
Alex Hoppen
4883ee7088 Merge pull request #2088 from ahoppen/cancellation-issue
Wait for request to be sent to sourcekitd before cancelling it in `SwiftSourceKitPluginTests.testCancellation`
2025-03-26 14:39:25 -07:00
Alex Hoppen
73016af24e Make workspace/synchronize a non-experimental request
This request is generally useful, not only for tests within SourceKit-LSP but also:
- In editor tests that want to test the integration with SourceKit-LSP
- In code analysis tools that want to gather project information using SourceKit-LSP and need an up-to-date index for that.

Remove the experimental feature guard from `workspace/_synchronize`, consequently rename it to `workspace/synchronize` and only guard the `buildServerUpdates` option on the synchronize request by an experimental feature because its long-term usefulness is still not fully understood yet.
2025-03-26 10:08:20 -07:00
Alex Hoppen
0f5727f4f0 Introduce assertContains to check that a sequence/string contains an element/substring
This also prints the sequence and expected element on failure, which is useful for debugging.
2025-03-25 19:12:51 -07:00