Skip to content

Commit cbf04ea

Browse files
Replace newlines with spaces in property descriptions
1 parent 2270836 commit cbf04ea

File tree

3 files changed

+49
-65
lines changed

3 files changed

+49
-65
lines changed

Documentation/Configuration File.md

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,16 @@ The structure of the file is currently not guaranteed to be stable. Options may
1515

1616
`config.json` is a JSON file with the following structure. All keys are optional and unknown keys are ignored.
1717
- `swiftPM`: Options for SwiftPM workspaces.
18-
- `configuration: "debug"|"release"`: The configuration to build the project for during background indexing
19-
and the configuration whose build folder should be used for Swift
20-
modules if background indexing is disabled.
21-
Equivalent to SwiftPM's `--configuration` option.
22-
- `scratchPath: string`: Build artifacts directory path. If nil, the build system may choose a default value.
23-
This path can be specified as a relative path, which will be interpreted relative to the project root.
24-
Equivalent to SwiftPM's `--scratch-path` option.
18+
- `configuration: "debug"|"release"`: The configuration to build the project for during background indexing and the configuration whose build folder should be used for Swift modules if background indexing is disabled. Equivalent to SwiftPM's `--configuration` option.
19+
- `scratchPath: string`: Build artifacts directory path. If nil, the build system may choose a default value. This path can be specified as a relative path, which will be interpreted relative to the project root. Equivalent to SwiftPM's `--scratch-path` option.
2520
- `swiftSDKsDirectory: string`: Equivalent to SwiftPM's `--swift-sdks-path` option.
2621
- `swiftSDK: string`: Equivalent to SwiftPM's `--swift-sdk` option.
2722
- `triple: string`: Equivalent to SwiftPM's `--triple` option.
2823
- `cCompilerFlags: string[]`: Extra arguments passed to the compiler for C files. Equivalent to SwiftPM's `-Xcc` option.
2924
- `cxxCompilerFlags: string[]`: Extra arguments passed to the compiler for C++ files. Equivalent to SwiftPM's `-Xcxx` option.
3025
- `swiftCompilerFlags: string[]`: Extra arguments passed to the compiler for Swift files. Equivalent to SwiftPM's `-Xswiftc` option.
3126
- `linkerFlags: string[]`: Extra arguments passed to the linker. Equivalent to SwiftPM's `-Xlinker` option.
32-
- `disableSandbox: boolean`: Disables running subprocesses from SwiftPM in a sandbox. Equivalent to SwiftPM's `--disable-sandbox` option.
33-
Useful when running `sourcekit-lsp` in a sandbox because nested sandboxes are not supported.
27+
- `disableSandbox: boolean`: Disables running subprocesses from SwiftPM in a sandbox. Equivalent to SwiftPM's `--disable-sandbox` option. Useful when running `sourcekit-lsp` in a sandbox because nested sandboxes are not supported.
3428
- `compilationDatabase`: Dictionary with the following keys, defining options for workspaces with a compilation database.
3529
- `searchPaths: string[]`: Additional paths to search for a compilation database, relative to a workspace root.
3630
- `fallbackBuildSystem`: Dictionary with the following keys, defining options for files that aren't managed by any build system.
@@ -46,32 +40,16 @@ The structure of the file is currently not guaranteed to be stable. Options may
4640
- `indexPrefixMap: [string: string]`: Path remappings for remapping index data for local use.
4741
- `maxCoresPercentageToUseForBackgroundIndexing: number`: A hint indicating how many cores background indexing should use at most (value between 0 and 1). Background indexing is not required to honor this setting.
4842
- `updateIndexStoreTimeout: integer`: Number of seconds to wait for an update index store task to finish before killing it.
49-
- `logging`: Options related to logging, changing SourceKit-LSP’s logging behavior on non-Apple platforms.
50-
On Apple platforms, logging is done through the [system log](Diagnose%20Bundle.md#Enable%20Extended%20Logging).
51-
These options can only be set globally and not per workspace.
43+
- `logging`: Options related to logging, changing SourceKit-LSP’s logging behavior on non-Apple platforms. On Apple platforms, logging is done through the [system log](Diagnose%20Bundle.md#Enable%20Extended%20Logging). These options can only be set globally and not per workspace.
5244
- `level: "debug"|"info"|"default"|"error"|"fault"`: The level from which one onwards log messages should be written.
53-
- `privacyLevel: "sensitive"|"private"|"public"`: Whether potentially sensitive information should be redacted.
54-
Default is `public`, which redacts potentially sensitive information.
55-
- `inputMirrorDirectory: string`: Write all input received by SourceKit-LSP on stdin to a file in this directory.
56-
Useful to record and replay an entire SourceKit-LSP session.
45+
- `privacyLevel: "sensitive"|"private"|"public"`: Whether potentially sensitive information should be redacted. Default is `public`, which redacts potentially sensitive information.
46+
- `inputMirrorDirectory: string`: Write all input received by SourceKit-LSP on stdin to a file in this directory. Useful to record and replay an entire SourceKit-LSP session.
5747
- `defaultWorkspaceType: "buildServer"|"compilationDatabase"|"swiftPM"`: Default workspace type (buildserver|compdb|swiftpm). Overrides workspace type selection logic.
5848
- `generatedFilesPath: string`: Directory in which generated interfaces and macro expansions should be stored.
5949
- `backgroundIndexing: boolean`: Whether background indexing is enabled.
60-
- `backgroundPreparationMode: string`: Determines how background indexing should prepare a target. Possible values are:
61-
- `build`: Build a target to prepare it.
62-
- `noLazy`: Prepare a target without generating object files but do not do lazy type checking and function body skipping.
63-
- `enabled`: Prepare a target without generating object files and the like.
64-
- `cancelTextDocumentRequestsOnEditAndClose: boolean`: Whether sending a `textDocument/didChange` or `textDocument/didClose` notification for a document should cancel
65-
all pending requests for that document.
50+
- `backgroundPreparationMode: string`: Determines how background indexing should prepare a target. Possible values are: - `build`: Build a target to prepare it. - `noLazy`: Prepare a target without generating object files but do not do lazy type checking and function body skipping. - `enabled`: Prepare a target without generating object files and the like.
51+
- `cancelTextDocumentRequestsOnEditAndClose: boolean`: Whether sending a `textDocument/didChange` or `textDocument/didClose` notification for a document should cancel all pending requests for that document.
6652
- `experimentalFeatures: ("on-type-formatting")[]`: Experimental features that are enabled.
67-
- `swiftPublishDiagnosticsDebounceDuration: number`: The time that `SwiftLanguageService` should wait after an edit before starting to compute diagnostics and
68-
sending a `PublishDiagnosticsNotification`.
69-
- `workDoneProgressDebounceDuration: number`: When a task is started that should be displayed to the client as a work done progress, how many milliseconds to
70-
wait before actually starting the work done progress. This prevents flickering of the work done progress in the
71-
client for short-lived index tasks which end within this duration.
72-
- `sourcekitdRequestTimeout: number`: The maximum duration that a sourcekitd request should be allowed to execute before being declared as timed out.
73-
In general, editors should cancel requests that they are no longer interested in, but in case editors don't cancel
74-
requests, this ensures that a long-running non-cancelled request is not blocking sourcekitd and thus most semantic
75-
functionality.
76-
In particular, VS Code does not cancel the semantic tokens request, which can cause a long-running AST build that
77-
blocks sourcekitd.
53+
- `swiftPublishDiagnosticsDebounceDuration: number`: The time that `SwiftLanguageService` should wait after an edit before starting to compute diagnostics and sending a `PublishDiagnosticsNotification`.
54+
- `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.
55+
- `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.

Utilities/ConfigSchemaGen/Sources/ConfigSchemaGen/OptionSchema.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,27 +176,33 @@ struct OptionSchemaContext {
176176
}
177177

178178
private static func extractDocComment(_ trivia: Trivia) -> String? {
179-
let docContents = trivia.compactMap { piece in
179+
var docLines = trivia.flatMap { piece in
180180
switch piece {
181181
case .docBlockComment(let text):
182182
// Remove `/**` and `*/`
183183
assert(text.hasPrefix("/**") && text.hasSuffix("*/"), "Unexpected doc block comment format: \(text)")
184-
return String(text.dropFirst(3).dropLast(2))
184+
return text.dropFirst(3).dropLast(2).split { $0.isNewline }
185185
case .docLineComment(let text):
186186
// Remove `///` and leading space
187187
assert(text.hasPrefix("///"), "Unexpected doc line comment format: \(text)")
188-
var text = text.dropFirst(3)
189-
while text.first?.isWhitespace == true {
190-
text = text.dropFirst()
191-
}
192-
return String(text)
188+
let text = text.dropFirst(3)
189+
return [text]
193190
default:
194-
return nil
191+
return []
195192
}
196193
}
197-
guard !docContents.isEmpty else {
194+
guard !docLines.isEmpty else {
198195
return nil
199196
}
200-
return docContents.joined(separator: "\n")
197+
// Trim leading spaces for each line and skip empty lines
198+
docLines = docLines.compactMap {
199+
guard !$0.isEmpty else { return nil }
200+
var trimmed = $0
201+
while trimmed.first?.isWhitespace == true {
202+
trimmed = trimmed.dropFirst()
203+
}
204+
return trimmed
205+
}
206+
return docLines.joined(separator: " ")
201207
}
202208
}

0 commit comments

Comments
 (0)