Commit Graph

42 Commits

Author SHA1 Message Date
Alex Hoppen
8aa8fa0ff8 Remove offensive terms from the codebase 2025-03-07 13:58:02 -08: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
2a1fd10295 Add an experimental LSP request to return the output paths for all files in a target 2025-03-06 08:30:47 -08:00
Alex Hoppen
655a93f05a Add structure to the index logs
When the client supports it, communicate the structure of tasks that were stared during background indexing or by the build server to the client. If there are multiple operations happening in parallel, this allows the client to display them in separate log tracks instead of interspersing them with the emoji prefixes like we do today.
2025-03-04 16:36:26 -08:00
Alex Hoppen
6a1d923f5b Add a request to check if SourceKit-LSP is currently performing any indexing 2025-02-27 12:52:28 -08:00
Alex Hoppen
f4e015b3c0 Merge pull request #1988 from ahoppen/sourcekitoptions
Add an experimental request to return the build settings that SourceKit-LSP uses to process a file
2025-02-26 16:06:20 -08:00
Alex Hoppen
9496b49c72 Add an experimental request to return the build settings that SourceKit-LSP uses to process a file
This can be useful to IDEs that want to perform some additional semantic processing of source files, which requires knowledge of a file’s build settings.
2025-02-26 09:12:47 -08:00
Alex Hoppen
1727a7bdf7 Remove options to override the index store path and index database path
We should always infer these from the build system and I can’t think of a reason to override these settings.
2025-02-25 14:24:15 -08:00
Alex Hoppen
f1aeb6c196 Add an experimental request to pause background indexing
This request allows IDEs to disable SourceKit-LSP’s background indexing functionality when it requires all compute resources for other, more interactive, tasks.
2025-02-21 08:09:34 -08:00
Ben Barham
a5343852c6 Add option to skip building and running plugins
This *shouldn't* be needed, but allows running plugins to be skipped if
there's any unexpected interactions with background indexing.
2025-02-17 19:14:34 -08:00
Ben Barham
cea30e54b0 Add a couple missing SwiftPM options 2025-02-17 19:11:30 -08:00
Alex Hoppen
4ec669f834 Hide internal options from SourceKit-LSP configuration file documentation 2025-02-17 13:09:05 -08:00
Ben Barham
0c896696c9 Allow workspace options to affect build system search
There were a few places that options only took place *after* determining
a build system, even though we have multiple that impact the search (eg.
`defaultBuildSystem` and `searchPaths`).

Additionally track project root and configuration paths separately, so
that when searching for implicit workspaces we can make sure to skip
creating duplicates.
2025-01-17 08:36:36 -08:00
Alex Hoppen
69121eed95 Merge pull request #1906 from ahoppen/add-sourcekit-plugin
Add a SourceKit plugin to handle code completion requests
2025-01-15 12:42:18 -08:00
Alex Hoppen
e5f1bbfc03 Set plugin paths in all tests
Otherwise, we were trying to load sourcekitd without the plugins for the normal SourceKIt-LSP tests and with the plugins for the plugin tests.
2025-01-09 14:09:01 +01:00
Alex Hoppen
c214a5fdb1 Merge pull request #1905 from ahoppen/output-mirror
Add option to generate an output mirror file that contains the exact data sent from SourceKit-LSP to the client
2025-01-03 15:11:52 +01:00
Alex Hoppen
5330795404 Add option to generate an output mirror file that contains the exact data sent from SourceKit-LSP to the client
This could help us debug low-level issues of SourceKit-LSP to client communication such as https://github.com/swiftlang/sourcekit-lsp/issues/1890.
2025-01-02 19:12:50 +01:00
Alex Hoppen
ede40883f5 Merge pull request #1898 from Kila2/feature/config-build-settings-timeout
feature support override buildSettingsTimeout by workspace config.json
2025-01-02 09:40:20 +01:00
lijunliang.9819
cf58f14215 feature support override buildSettingsTimeout by workspace config.json 2024-12-23 11:30:18 +08:00
Yuta Saito
7597945e38 Use an enum for backgroundPreparationMode in the configuration file instead of a string 2024-12-09 02:12:12 +09:00
Yuta Saito
96b582c189 Remove duplicate possible values from defaultWorkspaceType 2024-12-08 15:03:45 +09:00
Yuta Saito
227083654f Add missing periods to doc comment sentences for SourceKitLSPOptions 2024-12-08 14:19:22 +09:00
Yuta Saito
9b07134f76 Generate JSON Schema and Markdown doc for .sourcekit-lsp/config.json
Providing a JSON schema for the configuration file should improve the
developer experience thanks to better auto-completion and diagnostics
support provided by some editors.

Additionally, we have been manually maintaining the configuration file
format documentation in `Documentation/Configuration File.md`, but it's
easy for the documentation to get out of sync with the actual schema.

This change introduces a new tool, `ConfigSchemaGen`, that generates a
JSON schema and a Markdown document for the configuration file based on
the Swift type definitions in the `SKOptions` module by using
swift-syntax.
2024-12-01 14:48:16 +09:00
MahdiBM
a2eb7b9b2c Handle on-type formatting requests 2024-11-21 16:07:22 +03:30
Alex Hoppen
84fc3fec1a Enable background indexing by default 2024-11-15 16:58:40 -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
1d7c27bc4b Adopt MemberImportVisibility 2024-11-05 21:04:01 -08:00
Alex Hoppen
98c44f89eb Add a logging option to record all notifications received by SoruceKit-LSP
This allows us to record the communication between SourceKit-LSP and the editor on a very low level to inspect any transfer issues. It also allows us to record an entire SourceKit-LSP session and replay it using

```
cat /path/to/mirror.log - | path/to/sourcekit-lsp
```
2024-10-31 11:35:13 -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
Alex Hoppen
38ac399b58 Reduce the debounce duration to publish diagnostics to 1s
We received two feedbacks that the 2s timeout is too long. 2s was a somewhat arbitrary choice, let’s reduce it to 1s.

Fixes #1753
2024-10-14 09:51:43 -07:00
Alex Hoppen
947e5269c4 Reduce the number of public imports 2024-09-30 07:50:12 -07:00
Alex Hoppen
8cd831b55d Adopt InternalImportsByDefault 2024-09-27 09:17:13 -07:00
Alex Hoppen
32613f28c5 Log redacted versions of the requests if private logging is disabled
Even if we don’t want to log any sensitive information, we can still log the keys of JSON objects and insensitive values such as integers and booleans.
2024-09-23 08:49:37 -07:00
Alex Hoppen
0f56e5f32e Simplify FallbackBuildSystem to a free function returning fallback arguments 2024-09-16 10:12:09 -07:00
Alex Hoppen
d86a32bc19 Remove custom decoding function from SourceKitLSPOptions
We forgot to decode the following keys in the custom decode function, which meant that you couldn’t set them using SourceKit-LSP’s `config.json` file.
- `backgroundPreparationMode`
- `sourcekitdRequestTimeout`
- `cancelTextDocumentRequestsOnEditAndClose`

We had the custom decoder function so that the keys weren’t required in the JSON but we could access eg. `SwiftPMOptions` without needing to deal with optionals in the codebase.

Make the accesses to these nested options structs a little more verbose but eliminate the source of the above bug, which seems like a good tradeoff.
2024-09-06 13:45:24 -07:00
Alex Hoppen
1e409c97e2 Implicitly cancel text document requests when the document is edited or closed
As a user makes an edit to a file, these requests are most likely no longer relevant. It also makes sure that a long-running sourcekitd request can't block the entire language server if the client does not cancel all requests. For example, consider the following sequence of requests:
 - `textDocument/semanticTokens/full` for document A
 - `textDocument/didChange` for document A
 - `textDocument/formatting` for document A

If the editor is not cancelling the semantic tokens request on edit (like VS Code does), then the `didChange` notification is blocked on the semantic tokens request finishing. Hence, we also can't run the `textDocument/formatting` request. Cancelling the semantic tokens on the edit fixes the issue.

rdar://133987424
2024-08-15 15:32:26 -07:00
Alex Hoppen
4a10d3dc1b Merge pull request #1615 from ahoppen/adjustable-log-linux
Add configuration options to adjust log level and log privacy level on non-Apple platforms
2024-08-07 08:45:14 -07:00
Alex Hoppen
1f74b83854 Add configuration options to adjust log level and log privacy level on non-Apple platforms
Also adjust the log privacy level on non-Apple platforms to `public` and don’t log potentially sensitive information by default.

rdar://132525691
Resolves #1591
2024-08-06 18:09:38 -07:00
Alex Hoppen
7e2d12a7a0 Add configuration option to disable the sandbox for SwiftPM operations
Disabling the sandbox is needed to run tests for the Swift VS Code extension in a sandbox.
2024-08-01 09:24:17 -07:00
Alex Hoppen
7790706ffd Log the options with which SourceKit-LSP is launched 2024-07-26 08:19:06 -07:00
Alex Hoppen
6d34d70883 Split SourceKitLSPOptions out of SKCore
This only leaves build system functionality in SKCore, which allows us to rename SKCore.
2024-07-25 09:11:13 -07:00