You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New request from the client to the server to retrieve the compiler arguments that SourceKit-LSP uses to process the document.
512
+
513
+
This request does not require the document to be opened in SourceKit-LSP. This is also why it has the `workspace/` instead of the `textDocument/` prefix.
514
+
515
+
> [!IMPORTANT]
516
+
> This request is experimental, guarded behind the `sourcekit-options-request` experimental feature, and may be modified or removed in future versions of SourceKit-LSP without notice. Do not rely on it.
517
+
518
+
519
+
- params: `SourceKitOptionsRequest`
520
+
- result: `SourceKitOptionsResult`
521
+
522
+
```ts
523
+
exportinterfaceSourceKitOptionsRequest {
524
+
/**
525
+
* The document to get options for
526
+
*/
527
+
textDocument: TextDocumentIdentifier;
528
+
529
+
/**
530
+
* If specified, explicitly request the compiler arguments when interpreting the document in the context of the given
531
+
* target.
532
+
*
533
+
* The target URI must match the URI that is used by the BSP server to identify the target. This option thus only
534
+
* makes sense to specify if the client also controls the BSP server.
535
+
*
536
+
* When this is `null`, SourceKit-LSP returns the compiler arguments it uses when the the document is opened in the
537
+
* client, ie. it infers a canonical target for the document.
538
+
*/
539
+
target?:DocumentURI;
540
+
541
+
/**
542
+
* Whether SourceKit-LSP should ensure that the document's target is prepared before returning build settings.
543
+
*
544
+
* There is a tradeoff whether the target should be prepared: Preparing a target may take significant time but if the
545
+
* target is not prepared, the build settings might eg. refer to modules that haven't been built yet.
546
+
*/
547
+
prepareTarget: bool;
548
+
549
+
/**
550
+
* If set to `true` and build settings could not be determined within a timeout (see `buildSettingsTimeout` in the
551
+
* SourceKit-LSP configuration file), this request returns fallback build settings.
552
+
*
553
+
* If set to `true` the request only finishes when build settings were provided by the build system.
554
+
*/
555
+
allowFallbackSettings: bool
556
+
}
557
+
558
+
/**
559
+
* The kind of options that were returned by the `workspace/_sourceKitOptions` request, ie. whether they are fallback
560
+
* options or the real compiler options for the file.
561
+
*/
562
+
exportnamespaceSourceKitOptionsKind {
563
+
/**
564
+
* The SourceKit options are known to SourceKit-LSP and returned them.
565
+
*/
566
+
export const normal="normal"
567
+
568
+
/**
569
+
* SourceKit-LSP was unable to determine the build settings for this file and synthesized fallback settings.
570
+
*/
571
+
export const fallback="fallback"
572
+
}
573
+
574
+
exportinterfaceSourceKitOptionsResult {
575
+
/**
576
+
* The compiler options required for the requested file.
577
+
*/
578
+
compilerArguments: string[];
579
+
580
+
/**
581
+
* The working directory for the compile command.
582
+
*/
583
+
workingDirectory?:string;
584
+
585
+
/**
586
+
* Whether SourceKit-LSP was able to determine the build settings or synthesized fallback settings.
587
+
*/
588
+
kind: SourceKitOptionsKind;
589
+
590
+
/**
591
+
* - `true` If the request requested the file's target to be prepared and the target needed preparing
592
+
* - `false` If the request requested the file's target to be prepared and the target was up to date
593
+
* - `nil`: If the request did not request the file's target to be prepared or the target could not be prepared for
594
+
* other reasons
595
+
*/
596
+
didPrepareTarget?:bool
597
+
598
+
/**
599
+
* Additional data that the BSP server returned in the `textDocument/sourceKitOptions` BSP request. This data is not
Copy file name to clipboardExpand all lines: Documentation/Configuration File.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ The structure of the file is currently not guaranteed to be stable. Options may
53
53
-`noLazy`: Prepare a target without generating object files but do not do lazy type checking and function body skipping. This uses SwiftPM's `--experimental-prepare-for-indexing-no-lazy` flag.
54
54
-`enabled`: Prepare a target without generating object files.
55
55
-`cancelTextDocumentRequestsOnEditAndClose: boolean`: Whether sending a `textDocument/didChange` or `textDocument/didClose` notification for a document should cancel all pending requests for that document.
56
-
-`experimentalFeatures: ("on-type-formatting"|"set-options-request")[]`: Experimental features that are enabled.
56
+
-`experimentalFeatures: ("on-type-formatting"|"set-options-request"|"sourcekit-options-request")[]`: Experimental features that are enabled.
57
57
-`swiftPublishDiagnosticsDebounceDuration: number`: The time that `SwiftLanguageService` should wait after an edit before starting to compute diagnostics and sending a `PublishDiagnosticsNotification`.
58
58
-`workDoneProgressDebounceDuration: number`: When a task is started that should be displayed to the client as a work done progress, how many milliseconds to wait before actually starting the work done progress. This prevents flickering of the work done progress in the client for short-lived index tasks which end within this duration.
59
59
-`sourcekitdRequestTimeout: number`: The maximum duration that a sourcekitd request should be allowed to execute before being declared as timed out. In general, editors should cancel requests that they are no longer interested in, but in case editors don't cancel requests, this ensures that a long-running non-cancelled request is not blocking sourcekitd and thus most semantic functionality. In particular, VS Code does not cancel the semantic tokens request, which can cause a long-running AST build that blocks sourcekitd.
/// The working directory to resolve any relative paths in `compilerArguments`.
27
32
packagevarworkingDirectory:String?=nil
28
33
34
+
/// The language that the document was interpreted as, and which implies the compiler to which the build settings
35
+
/// would be passed.
36
+
packagevarlanguage:Language
37
+
38
+
/// Additional data about the build settings that was received from the BSP server, will not be interpreted by
39
+
/// SourceKit-LSP but returned to clients in the `workspace/_sourceKitOptions` LSP request.
40
+
packagevardata:LSPAny?
41
+
29
42
/// Whether the build settings were computed from a real build system or whether they are synthesized fallback arguments while the build system is still busy computing build settings.
0 commit comments