21 Commits

Author SHA1 Message Date
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
1cfa8db1d8 Require Swift 6 to build SourceKit-LSP
This significantly cleans up our `import` statements
2025-03-07 08:05:49 -08: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
8cd831b55d Adopt InternalImportsByDefault 2024-09-27 09:17:13 -07:00
Alex Hoppen
8e3bb6bd2f Merge pull request #1573 from ahoppen/package-access-level 2024-07-20 21:55:38 -07:00
Alex Hoppen
2877675bd5 Adopt package access level
Change a l public declarations to the `package` access level, accept for:
- The `LanguageServerProtocol` module
- The `BuildServerProtocol` module
- `InProcessClient.InProcessSourceKitLSPClient`
- `LanguageServerProtocolJSONRPC` (I would like to create a more ergonomic API for this like `InProcessSourceKitLSPClient` in the future, but for now, we’ll leave it public)

Unfortunately, our pattern of marking functions as `@_spi(Testing) public` no longer works with the `package` access level because declarations at the `package` access level cannot be marked as SPI. I have decided to just mark these functions as `package`. Alternatives would be:
- Add an underscore to these functions, like we did for functions exposed for testing before the introduction of `SPI`
- Use `@testable` import in the test targets and mark the methods as `internal`

Resolves #1315
rdar://128295618
2024-07-19 09:54:30 -07:00
Alex Hoppen
edf19dbbd8 Import Darwin in files that use free
rdar://131965190
2024-07-18 11:30:23 -07:00
Finagolfin
1cf6c76897 Import new Bionic module from Android overlay instead where possible 2024-07-08 19:08:07 +05:30
Finagolfin
7c20015331 Import new Android overlay 2024-07-04 02:20:23 +05:30
Alex Hoppen
f1b34b1c9b Make SKD{Request,Response}{Dictionary,Array} Sendable 2024-03-20 11:48:50 +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
Alex Hoppen
f2e1707010 Make forEach and map on SKDResponseArray rethrowing 2024-01-25 18:44:43 -08:00
Alex Hoppen
84fdea9e05 Filter overrides in DefinitionRequest by receiver types 2023-11-29 09:03:36 -08:00
Alex Hoppen
d0fc00ce98 Format using swift-format
Add `.swift-format` to the repo and format the repo with `swift-format`.

This commit does not add any automation to enforce formatting of sourcekit-lsp in CI. The goal of this commit is to get the majority of source changes out of the way so that the diff of actually enforcing formatting will have fewer changes or conflicts.
2023-10-10 13:44:47 -07:00
Max Desiatov
66f1c0dbf2 Add support for Musl libc with canImport(Musl) checks (#772)
Since Musl is sufficiently different from Glibc (see https://wiki.musl-libc.org/functional-differences-from-glibc.html), it requires a different import, which now should be applied to files that have `import Glibc` in them.

Musl is a low footprint libc that's used in Linux distributions such as Alpine Linux, which allows producing fairly small container images. Additionally, unlike Glibc, musl allows full static linking, meaning apps can be easily distributed to an arbitrary Linux distribution that may have a version of Glibc incompatible with the one that Swift is usually built with or no Glibc installed at all.
2023-07-18 22:51:26 +01:00
YR Chen
031a0913e0 Import CRT to resolve free on Windows 2022-03-14 05:18:28 +08:00
fwcd
9b81cb25d1 Add SKDResponseArray.forEachUID 2021-05-18 13:13:49 +02:00
Ben Langmuir
ee7ef54e9d Merge pull request #345 from owenv/edu-notes-take-2
Expose diagnostic educational notes as diagnostic codes
2020-12-16 07:46:29 -08:00
Marcel Hlopko
3f506c5725 Import glibc 2020-12-15 17:24:37 +01:00
Owen Voorhees
77a81ad9c1 Expose diagnostic educational notes as diagnostic codes 2020-11-09 18:30:02 -08:00
Ben Langmuir
f9d26d6bcf [sourcekitd] Move SourceKitD to its own module and lightly refactor 2020-06-03 14:51:03 -07:00