Commit Graph

141 Commits

Author SHA1 Message Date
Alex Hoppen
7cc63f58b4 Merge pull request #1861 from ahoppen/log-package-loading
Log package loading messages to the index log
2024-12-06 09:02:27 -08:00
Alex Hoppen
e038c790db Merge pull request #1860 from ahoppen/bsp-server-language
Only load BSP servers that support one of the language we are interested in
2024-12-06 09:02:19 -08:00
Alex Hoppen
9bbb8f3287 Merge pull request #1854 from matthewbastien/documentation-language-service
Handle `*.md` and `*.tutorial` files from Swift DocC
2024-12-05 20:35:23 -08:00
Alex Hoppen
5914efd9b4 Log package loading messages to the index log 2024-12-05 20:26:50 -08:00
Alex Hoppen
8ea381d7be Only load BSP servers that support one of the language we are interested in
Instead of unconditionally loading any BSP server from one of the search locations, only load those that support, C, C++, Obj-C, Obj-C++ or Swift.
2024-12-05 16:59:07 -08:00
Matthew Bastien
f900b4ef2c Merge pull request #1853 from matthewbastien/include-all-build-target-resources
Include all resources in a build target's sources list
2024-12-05 16:49:06 -05:00
Matthew Bastien
8fd30908e7 handle *.md and *.tutorial files for Swift DocC 2024-12-05 11:18:49 -05:00
Matthew Bastien
f2fed7afa5 reduce code duplication
Co-authored-by: Alex Hoppen <alex@alexhoppen.de>
2024-12-05 10:48:56 -05:00
Matthew Bastien
3ea9a65d77 include all resources in a build target's sources list 2024-12-05 09:53:42 -05:00
Alex Hoppen
3131ca3c81 Merge pull request #1845 from ahoppen/version-specific-manifest
Provide build settings for version-specific package manifests
2024-12-03 14:43:06 -08:00
Alex Hoppen
cddd810455 Provide build settings for version-specific package manifests
Fixes #1670
rdar://136014520
2024-11-22 22:04:20 +01:00
Alex Hoppen
eb982d5b1e Fix quadratic performance issue in AsyncQueue<Serial>
Adding an item to `AsyncQueue` was linear in the number of pending queue items, thus adding n items to an `AsyncQueue` before any can execute is in O(n^2). This decision was made intentionally because the primary use case for `AsyncQueue` was to track pending LSP requests, of which we don’t expect to have too many pending requests at any given time.

While we can't fix the quadratic performance issue in general, we can resolve the quadratic issue of `AsyncQueue<Serial>` by making a new task only depend on the last item in the queue, which then transitively depends on all the previous items. `AsyncQueue<Serial>` are the queues that are most likely to contain many items.

Fixes #1725
rdar://137886469
2024-11-22 15:33:57 +01:00
Alex Hoppen
76304db5e2 Fix merge conflict
https://github.com/swiftlang/sourcekit-lsp/pull/1824 and https://github.com/swiftlang/sourcekit-lsp/pull/1832 raced.
2024-11-19 15:47:52 -08:00
Alex Hoppen
8d13afa73d Merge pull request #1824 from kateinoigakukun/katei/interpret-relative-scratch-dir
Allow `scratchPath` to be a relative path
2024-11-19 11:14:40 -08:00
Yuta Saito
184fa12389 Allow scratchPath to be relative paths
Interpret it as relative to the project root directory if it's a
relative path.
2024-11-19 11:19:54 +09:00
Alex Hoppen
be546308ca Use URL in many cases where we used AbsolutePath
We made quite a few fixes recently to make sure that path handling works correctly using `URL` on Windows. Use `URL` in most places to have a single type that represents file paths instead of sometimes using `AbsolutePath`.

While doing so, also remove usages of `TSCBasic.FileSystem` an `InMemoryFileSystem`. The pattern of using `InMemoryFileSystem` for tests was never consistently used and it was a little confusing that some types took a `FileSystem` parameter while other always assumed to work on the local file system.
2024-11-18 18:19:48 -08:00
Alex Hoppen
b01ae2adb6 Add Task{Start|Progress|Finish}Notification to BuildSystemMessageDependencyTracker 2024-11-15 17:02:53 -08:00
Alex Hoppen
c23b4ff776 Merge pull request #1803 from ahoppen/indexbuild-subfolder
Make `.index-build` a subdirectory of `.build`
2024-11-14 12:54:20 -08:00
Alex Hoppen
9c84a344c8 Merge pull request #1817 from ahoppen/bsp-review 2024-11-14 08:10:02 -08:00
Alex Hoppen
8c2def8ef9 Rename SKSupport to LanguageServerProtocolExtensions 2024-11-13 16:53:58 -08:00
Alex Hoppen
1f33ed484d Split SKUtilities from SKSupport 2024-11-13 16:53:54 -08:00
Alex Hoppen
47f3cd506b Split TSCExtensions into a separate module 2024-11-13 13:58:36 -08:00
Alex Hoppen
0fbb6466e7 Make BuildSystemKind a struct and rename to BuildSystemSpec 2024-11-13 10:23:43 -08:00
Alex Hoppen
c1e090ef33 Address minor review comments 2024-11-13 10:09:31 -08:00
Alex Hoppen
41a773f89a Merge pull request #1804 from ahoppen/remove-unnecessary-fault
Don’t log “Did not compute dependents for target”
2024-11-07 15:38:17 -08:00
Alex Hoppen
5c7d495ebd Merge pull request #1808 from ahoppen/member-import-visibility
Adopt `MemberImportVisibility`
2024-11-07 15:38:05 -08:00
Alex Hoppen
06f58db5c8 Use build/taskStart, build/taskProgress and build/taskFinish to communicate progress from a BSP server to the client
Instead of defining BSP extensions for `window/workDoneProgress/create` and `$/progress`, we should be able to use the standard `build/taskStart`, `build/taskProgress` and `build/taskFinish` messages to the same effect, as suggested by https://forums.swift.org/t/extending-functionality-of-build-server-protocol-with-sourcekit-lsp/74400/9.

Fixes #1783
rdar://138653131
2024-11-06 09:39:09 -08:00
Alex Hoppen
1d7c27bc4b Adopt MemberImportVisibility 2024-11-05 21:04:01 -08:00
Alex Hoppen
69e9a5cf54 Don’t log “Did not compute dependents for target”
Leaf targets don’t have dependents and that’s expected. We shouldn’t log a fault for them.
2024-11-04 15:58:57 -08:00
Alex Hoppen
ec0a7c4ef3 Make .index-build a subdirectory of .build
This means that users of SourceKit-LSP’s background indexing don’t need to add another directory to their `.gitignore`.
2024-11-04 15:34:59 -08:00
Alex Hoppen
5d47358236 Merge pull request #1762 from ahoppen/build-settings-timeout 2024-10-23 23:50:58 -07:00
Alex Hoppen
951e923245 Use withUnsafeFileSystemRepresentation to get the path of a URL on disk
`URL.path` returns forward slashes in the path on Windows (https://github.com/swiftlang/swift-foundation/issues/973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
2024-10-21 11:12:30 -07:00
Alex Hoppen
5bae73fca8 Use fallback build settings if build system doesn’t provide build settings within a timeout
When we receive build settings after hitting the timeout, we call `fileBuildSettingsChanged` on the delegate, which should cause the document to get re-opened in sourcekitd and diagnostics to get refreshed.

rdar://136332685
Fixes #1693
2024-10-16 10:55:29 -07:00
Rajveer
7b1f59e4a3 Update BSP connection build server config lookup path
Resolves #1695

Adopt `<workspace_root>/.bsp` search locations in addition to
`<workspace_root>/`.
2024-10-14 13:22:22 -07:00
Alex Hoppen
c16e33d281 Miscellaneous adjustments to make tests pass on Windows
This is mostly test infrastructure that needed adjusting.
2024-10-10 09:28:26 -07:00
Alex Hoppen
aa0aa927ca Stop using TSCBasic.resolveSymlinks and URL.resolvingSymlinksInPath 2024-10-09 13:16:57 -07:00
Alex Hoppen
ee29e31fb4 Merge pull request #1719 from ahoppen/explicit-bsp-shutdown
Explicitly shut down the build server when SourceKit-LSP is shut down
2024-10-02 10:27:15 -07:00
Alex Hoppen
3c7aa6f438 Merge pull request #1715 from ahoppen/bsp-cancellation
Share implementation of message handling on an `AsyncQueue` between `BuildSystemIntegration` and `SourceKitLSPServer`
2024-09-30 15:31:54 -07:00
Alex Hoppen
d25b65c307 Explicitly shut down the build server when SourceKit-LSP is shut down
The build server is automatically shut down using a background task when `BuildSystemManager` is deallocated.

This, however, leads to possible race conditions where the shutdown task might not finish before the test is done, which could result in the connection being reported as a leak. To avoid this problem, we want to explicitly shut, down the build server when the `SourceKitLSPServer` gets shut down.
2024-09-30 11:57:39 -07:00
Alex Hoppen
7befd0c648 Share implementation of message handling on an AsyncQueue between BuildSystemIntegration and SourceKitLSPServer
This gives us cancellation support for `BuiltInBuildSystemAdapter`.
2024-09-30 10:42:46 -07:00
Alex Hoppen
36478d87ed Allow build systems to specify the files to watch for changes
rdar://136014553
Resolves #1671
2024-09-30 10:33:32 -07:00
Alex Hoppen
d842579402 Merge pull request #1712 from ahoppen/build-system-logging-improvements
Improve logging surrounding build systems
2024-09-30 08:11:40 -07:00
Alex Hoppen
bd422cf5d7 Improve logging surrounding build systems 2024-09-27 11:07:39 -07:00
Alex Hoppen
b91f72f1d4 Merge pull request #1700 from ahoppen/build-settings-timeout
Use fallback build settings if build system doesn’t provide build settings within a timeout
2024-09-27 10:28:50 -07:00
Alex Hoppen
8cd831b55d Adopt InternalImportsByDefault 2024-09-27 09:17:13 -07:00
Alex Hoppen
fb5ee8e9c7 Miscellaneous adjustments to allow SourceKit-LSP to build using Swift 5.10 2024-09-26 18:23:59 -07:00
Alex Hoppen
2ec571b529 Revert "Require a Swift 6 compiler to build SourceKit-LSP"
This reverts commit 7ab7c01cdc.

# Conflicts:
#	Package.swift
2024-09-26 18:23:59 -07:00
Alex Hoppen
78217ec6a6 Use fallback build settings if build system doesn’t provide build settings within a timeout
When we receive build settings after hitting the timeout, we call `fileBuildSettingsChanged` on the delegate, which should cause the document to get re-opened in sourcekitd and diagnostics to get refreshed.

rdar://136332685
2024-09-26 17:50:58 -07:00
Alex Hoppen
bdf9615324 Specify explicit self in ExternalBuildSystemAdapter
I’m not entirely sure why but the file fails to compile with multiple arches without the `self`.
2024-09-26 13:29:59 -07:00
Alex Hoppen
2b3d733af6 Restart a BSP server after it has crashed
If a BSP server crashes, we should try to relaunch it. Use a similar relaunch logic as the one we use for `clangd`: Try restarting immediately unless the BSP server has crashed within the last 30 seconds, in which case we delay the restart by 10s.

rdar://136311009
Fixes #1686
2024-09-25 13:57:43 -07:00