Commit Graph

15 Commits

Author SHA1 Message Date
Rintaro Ishizaki 10be054a63 [SKUtilities] Fix Debouncer deadline reset on subsequent scheduleCalls
`inProgressData` was always storing `ContinuousClock.now + debounceDuration`
instead of the computed `targetDate`, causing the debounce deadline to reset
on every call rather than being fixed at the time of the first `scheduleCall`.
2026-03-26 15:06:56 -07:00
Owen Voorhees f04b971726 Adopt swift-tools-protocols 2025-10-31 14:11:11 -07:00
Hamish Knight 9e552ddd47 Avoid crashing on invalid range in editDocument
Rename `LineTable.replace(utf8Offset:length:with)` to `tryReplace`
and bail if the provided range is out of bounds of the buffer. This
ensures we match the behavior of SourceKit when handling an
`editor.replacetext` request.

rdar://161268691
2025-10-02 14:47:04 +01:00
Hamish Knight c3c1b8e116 NFC: Remove a couple of unused functions 2025-10-02 14:47:04 +01:00
Alex Hoppen 6074529dac Manually fix swift-format lint rules
- I think there are valid calls with mixing inline and trailing closures (notably `Debouncer`), so I’m considering whether we should disable that rule.
- The `forEach` rule is a little annoying because we have `forEach` on `SKDResponseArray`. But it caught two cases of using `forEach` on arrays, so I think it’s worth keeping.
2025-08-11 09:31:09 +02:00
Alex Hoppen 7f4f92e5bd Rename build system to build server in most cases
The term *build system* predated our wide-spread adoption of BSP for communicating between SourceKit-LSP to the build system and was never really the correct term anyway – ie. a `JSONCompilationDatabaseBuildSystem` never really sounded right. We now have a correct term for the communication layer between SourceKit-LSP: A build server. Rename most occurrences of *build system* to *build server* to reflect this. There are unfortunately a couple lingering instances of *build system* that we can’t change, most notably: `fallbackBuildSystem` in the config file, the `workspace/waitForBuildSystemUpdates` BSP extension request and the `synchronize-for-build-system-updates` experimental feature.
2025-08-02 08:45:01 +02:00
Alex Hoppen da90f34e10 Add contextual request support to sourcekit-lsp diagnose
Teach `sourcekit-lsp diagnose` how to extract contextual requests from the system log and use them to reduce sourcekitd crashes.
2025-05-12 15:39:52 +02:00
Matthew Bastien 17daedd961 add LRUCache to CMakeLists 2025-04-25 09:56:27 -04:00
Alex Hoppen d8aeeaffe6 Only pass key and not value to LRUCache.removeAll(where:)
The value isn’t needed here and the calls become cleaner if only the key is passed.
2025-04-23 18:54:45 +02:00
Matthew Bastien 2ae2e709b3 add LRUCache struct to SKUtilities 2025-04-17 13:46:01 -04:00
Alex Hoppen 18b18c2b12 Debounce filesBuildSettingsChanged calls
This helps in the following situation: A build system takes 5s to return build settings for a file and we have 10 requests for those build settings coming in that time period. Once we get build settings, we get 10 calls to `resultReceivedAfterTimeout` in `buildSettings(for:in:language:fallbackAfterTimeout:)`, all for the same document.
But calling `fileBuildSettingsChanged` once is totally sufficient.
2025-02-27 21:54:04 -08:00
Alex Hoppen 16f897aefa Make the SourceKit plugins work on Windows 2025-01-11 06:57:03 +01:00
Alex Hoppen 5709e1a864 Add a SourceKit plugin to handle code completion requests
This adds a sourcekitd plugin that drives the code completion requests. It also includes a `CompletionScoring` module that’s used to rank code completion results based on their contextual match, allowing us to show more relevant code completion results at the top.
2025-01-03 14:21:54 +01: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