11 Commits

Author SHA1 Message Date
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
3762e7a2a4 Fix all warnings
Fixes all warnings when building on macOS and Linux using Swift 6.1, Swift 6.2 and SDKs from Xcode 16.2 and Xcode 16.3
2025-08-25 14:40:16 +02: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
cf828a8135 Consistently add license headers to all files
To prepare for the GitHub Action license header check.
2025-03-06 22:01:00 -08:00
Alex Hoppen
b5186a0b43 Typedef enums in CodeCompletionSwiftInterop.h
This means we can omit the `enum` prefix when using these types in the header.
2025-01-16 11:26:03 -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
f5fb23ad4c Rename sourcekitd_ to sourcekitd_api_ and add nullability annotations to sourcekit_functions.h
Naming types in sourcekitd_functions.h `sourcekit_api_` instead of `sourcekitd_` indicates that these are types to be used with dynamically loaded sourcekitd libraries. It avoids confusion if sourcekitd is also linked, which adds the `sourcekitd_` symbols.

Adding nullability annotations to it is also just nice.

And some improved formatting never hurts.
2024-02-23 09:13:42 -08:00
Ben Langmuir
f9d26d6bcf [sourcekitd] Move SourceKitD to its own module and lightly refactor 2020-06-03 14:51:03 -07:00
Saleem Abdulrasool
54d5324613 build: add CMake build system 2019-12-04 16:47:34 -08:00
Ben Langmuir
aabf57a252 Import SourceKit-LSP sources 2018-11-13 15:50:48 -08:00