Commit Graph

120 Commits

Author SHA1 Message Date
Alex Hoppen
d6101a1c56 Merge pull request #848 from ahoppen/ahoppen/minor-cleanups
Fix a couple `FIXME: (async)`
2023-10-03 07:59:50 -07:00
Alex Hoppen
1b6015f8aa Make the folding range request return the request result as an async return value 2023-10-03 07:56:49 -07:00
Alex Hoppen
1f02b95e55 Shift responsibility for in-order message handling from Connection to SourceKitServer
This generally seems like the cleaner design because `SourceKitServer` is actually able to semantically inspect the message and decide whether it can be handled concurrently with other requests.
2023-10-03 07:56:49 -07:00
Alex Hoppen
0c30951ed4 Inline _handleUnknown
Since `ClangLanguageServerShim` calls directly into `SourceKitServer` we also no longer need the logic to forward a message from clangd to the editor in `handle`.
2023-10-02 17:04:08 -07:00
Alex Hoppen
abf456aa5b Make reloadPackageStatusCallback async 2023-10-02 17:00:04 -07:00
Alex Hoppen
eb597fd0a7 Remove a couple of async wrapper functions
These are no longer needed as all callers are async now.
2023-10-02 17:00:04 -07:00
Alex Hoppen
c642b37a96 Remove tracking of file build settings status in SourceKitServer and BuildSystemManager
The core idea here is that the toolchain language servers always call into `BuildSystemManager` and `BuildSystemManager` will always reply with build settings. If it hasn’t computed them yet, it will reply with fallback settings.

With that assumption, we can remove the `documentToPendingQueue` from `SourceKitServer` since there are no longer any documents that are pending – everything has a build settings immediately.

Similarly, `BuildSystemManager.mainFileStatuses` also isn’t needed anymore.

And lastly, since we know that `BuildSystemManager.buildSettings` will always return a value `registerForChangeNotifications` is changed not call `fileBuildSettingsChanged` immediately. Instead, it will only cause `fileBuildSettingsChanged` to be called when the file’s build settings change after the `registerForChangeNotifications` call.
2023-10-02 09:53:25 -07:00
Alex Hoppen
dffcc939f7 Change the build system to only notify delegate about changed files, not about new build settings
This defines away an entire class of data races if delegate callbacks are delivered out-of-order. If we aren’t providing the new build settings in the delegate callback, then it doesn’t matter if two `fileBuildSettingsChanged` calls change order since they don’t carry any state.
2023-10-02 09:53:25 -07:00
Alex Hoppen
ebcdbb6839 Make SwiftLanguageServer and ClangLanguageServerShim call directly into SourceKitServer instead of through a LocalConnection
`LocalConnection` with its dynamic registration of a message handler made the overall design unnecessarily complicated. If we just call `SourceKitServer` from `ClangLanguageServerShim` and `SwiftLanguageServer` directly, it’s a lot more obvious, what’s going on, IMO.
2023-10-02 09:49:12 -07:00
Alex Hoppen
607f040c28 Remove tracking of RequestCancelKey to CancellationToken
We want to implement cancellation on top of Swift concurrency’s cancellation, which will most likely need a completely different paradigm.
2023-10-02 09:49:01 -07:00
Alex Hoppen
54e6d958d6 Make all methods on BuildSystem async
This is the prerequisite for making the build systems actors.
2023-10-02 09:47:21 -07:00
Alex Hoppen
443fc7a776 Make BuildSystemManager an actor
Again, fairly straightforward.
2023-10-02 09:47:17 -07:00
Alex Hoppen
5952ddda24 Fix typos 2023-10-02 09:44:18 -07:00
Alex Hoppen
07eb45bb56 Wait for documents to be re-opened before setting the clangd status to be connected again 2023-10-02 09:44:14 -07:00
Alex Hoppen
dd8231315b Migrate ClangLanguageServerShim to be an actor
Fairly straightforward since we have all the infrastructure now.
2023-10-02 09:44:06 -07:00
Alex Hoppen
f1548bd757 Call into the BuildSystemManager from SwiftLanguageServer to get build settings
Instead of storing build settings inside the language servers based on update notifications from the build system, always call into the `BuildSystemManager` to get the build settings.

Overall, I think this is a much clearer separation of concerns and will allow us to remove `SourceKitServer.documentToPendingQueue` in a follow-up commit as `SwiftLanguageServer` can always directly call into `BuildSystemManager` to get build settings and we don’t need to wait for the initial notification to receive the first build settings.

This requies `BuildServerBuildSystem` to keep track of the build settings it has received from the BSP server.

`ClangLanguageServer` still caches build settings locally. `ClangLanguageServer` will change to the same pull-based model in a follow-up commit.
2023-10-02 09:44:01 -07:00
Alex Hoppen
c4e50974d1 Make all the methods in ToolchainLanguageServer async
This is a preparation step for making `SwiftLanguageServer` and `ClangLanguageServerShim` actors.
2023-10-02 09:43:51 -07:00
Alex Hoppen
09dc0bc82f Make SourceKitServer an actor
Unfortuantely, we have a few potential out-of-order exeuction possibilities while we migrate everything else to also be asyncronous. But those should be low-probability issues that we can fix in follow-up commits, so I think it’s fine for now. All of these places are marked with `FIXME: (async)`
2023-10-02 09:43:42 -07:00
Alex Hoppen
b22af35eb1 Revert asyncificaiton changes
The asyncification changes caused some non-deterministic test failures. I believe that some of these are due to race conditions that are the result of the partial transition to actors.

Instead of merging the asyncification piece by piece, I will collect the changes asyncification changes in a branch and then qualify that branch througougly (running CI multiple times) before merging it into `main`.
2023-09-30 10:09:59 -07:00
Alex Hoppen
e663bbcf8a Make all methods on BuildSystem async
This is the prerequisite for making the build systems actors.
2023-09-29 16:55:51 -07:00
Alex Hoppen
5e37b329a1 Make BuildSystemManager an actor
Again, fairly straightforward.
2023-09-29 16:46:30 -07:00
Alex Hoppen
66a27489d2 Fix typos 2023-09-28 22:37:57 -07:00
Alex Hoppen
cc5a83bc40 Wait for documents to be re-opened before setting the clangd status to be connected again 2023-09-28 22:37:57 -07:00
Alex Hoppen
33cf8ccf36 Migrate ClangLanguageServerShim to be an actor
Fairly straightforward since we have all the infrastructure now.
2023-09-28 22:37:57 -07:00
Alex Hoppen
23b2db0588 Call into the BuildSystemManager from SwiftLanguageServer to get build settings
Instead of storing build settings inside the language servers based on update notifications from the build system, always call into the `BuildSystemManager` to get the build settings.

Overall, I think this is a much clearer separation of concerns and will allow us to remove `SourceKitServer.documentToPendingQueue` in a follow-up commit as `SwiftLanguageServer` can always directly call into `BuildSystemManager` to get build settings and we don’t need to wait for the initial notification to receive the first build settings.

This requies `BuildServerBuildSystem` to keep track of the build settings it has received from the BSP server.

`ClangLanguageServer` still caches build settings locally. `ClangLanguageServer` will change to the same pull-based model in a follow-up commit.
2023-09-28 22:37:57 -07:00
Alex Hoppen
0b345738a6 Make all the methods in ToolchainLanguageServer async
This is a preparation step for making `SwiftLanguageServer` and `ClangLanguageServerShim` actors.
2023-09-28 22:37:41 -07:00
Ben Barham
762532539e Revert "Make all the methods in ToolchainLanguageServer async"
This reverts commit a8b84256b3.
2023-09-28 15:51:21 -07:00
Ben Barham
15bdcc42e1 Revert "Call into the BuildSystemManager from SwiftLanguageServer to get build settings"
This reverts commit 9dd38798bb.
2023-09-28 15:51:07 -07:00
Ben Barham
212c497eb0 Revert "Migrate ClangLanguageServerShim to be an actor"
This reverts commit d699645a5f.
2023-09-28 15:51:01 -07:00
Ben Barham
cd4e733de2 Revert "Wait for documents to be re-opened before setting the clangd status to be connected again"
This reverts commit b9fa20303d.
2023-09-28 15:50:45 -07:00
Ben Barham
ffcedc775d Revert "Fix typos"
This reverts commit aaa9bd49a1.
2023-09-28 15:50:28 -07:00
Alex Hoppen
aaa9bd49a1 Fix typos 2023-09-27 16:51:55 -07:00
Alex Hoppen
b9fa20303d Wait for documents to be re-opened before setting the clangd status to be connected again 2023-09-27 16:51:54 -07:00
Alex Hoppen
d699645a5f Migrate ClangLanguageServerShim to be an actor
Fairly straightforward since we have all the infrastructure now.
2023-09-27 16:20:53 -07:00
Alex Hoppen
9dd38798bb Call into the BuildSystemManager from SwiftLanguageServer to get build settings
Instead of storing build settings inside the language servers based on update notifications from the build system, always call into the `BuildSystemManager` to get the build settings.

Overall, I think this is a much clearer separation of concerns and will allow us to remove `SourceKitServer.documentToPendingQueue` in a follow-up commit as `SwiftLanguageServer` can always directly call into `BuildSystemManager` to get build settings and we don’t need to wait for the initial notification to receive the first build settings.

This requies `BuildServerBuildSystem` to keep track of the build settings it has received from the BSP server.

`ClangLanguageServer` still caches build settings locally. `ClangLanguageServer` will change to the same pull-based model in a follow-up commit.
2023-09-27 16:20:53 -07:00
Alex Hoppen
a8b84256b3 Make all the methods in ToolchainLanguageServer async
This is a preparation step for making `SwiftLanguageServer` and `ClangLanguageServerShim` actors.
2023-09-27 16:20:52 -07:00
Alex Hoppen
351eaa2393 Make SourceKitServer an actor
Unfortuantely, we have a few potential out-of-order exeuction possibilities while we migrate everything else to also be asyncronous. But those should be low-probability issues that we can fix in follow-up commits, so I think it’s fine for now. All of these places are marked with `FIXME: (async)`
2023-09-27 09:48:21 -07:00
Alex Hoppen
11ccca183b Remove dynamic registration of request handlers 2023-09-19 17:32:54 -07:00
Alex Hoppen
7699d13bef Remove dynamic registration of notifications 2023-09-19 17:32:54 -07:00
Alex Hoppen
026d3cb1d6 Remove LanguageServerEndpoint
Since we moved `BuilderServerHandler` and `ClangLanguageServerShim` to directly conform to `MessageHandler`, `SourceKitServer` was the only type inheriting from `LanguageServerEndpoint` and we can thus remove the type.
2023-09-19 17:32:54 -07:00
Alex Hoppen
ae596c267b Remove LanguageServer
Was only used by `SourceKitServer` now.
2023-09-19 17:32:54 -07:00
Zachary
6339c5a04c Fix typo in reloadPackage token name 2023-09-15 12:01:39 -04:00
Alex Hoppen
7604a1d389 Show a progress indicator in the editor if SourceKit-LSP is reloading packages
I noticed that the initial package loading can take ~5s. It’s good behavior to inform the client that sourcekit-lsp is busy reloading the package, showing the user that semantic functionality might not be ready yet.

https://github.com/apple/sourcekit-lsp/issues/620
rdar://112498447
2023-08-03 18:25:47 -07:00
Ben Barham
e540e169bc Revert "Show a progress indicator in the editor if SourceKit-LSP is reloading packages" 2023-07-17 21:56:35 -07:00
Alex Hoppen
24317f1e97 Show a progress indicator in the editor if SourceKit-LSP is reloading packages
I noticed that the initial package loading can take ~5s. It’s good behavior to inform the client that sourcekit-lsp is busy reloading the package, showing the user that semantic functionality might not be ready yet.

https://github.com/apple/sourcekit-lsp/issues/620
rdar://111917300
2023-07-17 11:08:20 -07:00
Tristan Labelle
e91c83fd72 Remove reporting diagnostic support at SourceKitServer initialization 2023-05-31 10:30:54 -04:00
Tristan Labelle
0da6291d22 Use CapabilityRegistry in ToolchainLanguageServer implementations 2023-05-26 10:35:26 -04:00
Tristan Labelle
bc444519c8 Report diagnostics support in SourceKitServer. 2023-05-26 10:35:26 -04:00
Adam Fowler
07b9cc21e4 Requested changes from PR
rename symbol to symbolUSR
Cleanup OpenInterfaceRequest.init
2023-05-22 22:37:45 +01:00
Adam Fowler
0da1d40a28 Move module name split into OpenInterfaceRequest
Use group names when running open interface request
2023-05-21 10:26:00 +01:00