|
| 1 | +# Configuration File |
| 2 | + |
| 3 | +`.sourcekit-lsp/config.json` configuration files can be used to modify the behavior of SourceKit-LSP in various ways. The following locations are checked. Settings in later configuration files override settings in earlier configuration files |
| 4 | +- `~/.sourcekit-lsp/config.json` |
| 5 | +- On macOS: `~/Library/Application Support/org.swift.sourcekit-lsp/config.json` from the various `Library` folders on the system |
| 6 | +- If the `XDG_CONFIG_HOME` environment variable is set: `$XDG_CONFIG_HOME/org.swift.sourcekit-lsp/config.json` |
| 7 | +- A `.sourcekit-lsp/config.json` file in a workspace’s root |
| 8 | + |
| 9 | +The structure of the file is currently not guaranteed to be stable. Options may be removed or renamed. |
| 10 | + |
| 11 | +## Structure |
| 12 | + |
| 13 | +`config.json` is a JSON file with the following structure. All keys are optional and unknown keys are ignored. |
| 14 | + |
| 15 | +- `swiftPM`: Dictionary with the following keys, defining options for SwiftPM workspaces |
| 16 | + - `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 |
| 17 | + - `scratchPath: string`: Build artifacts directory path. If nil, the build system may choose a default value |
| 18 | + - `cCompilerFlags: string[]`: Extra arguments passed to the compiler for C files |
| 19 | + - `cxxCompilerFlags: string[]`: Extra arguments passed to the compiler for C++ files |
| 20 | + - `swiftCompilerFlags: string[]`: Extra arguments passed to the compiler for Swift files |
| 21 | + - `linkerFlags: string[]`: Extra arguments passed to the linker |
| 22 | +- `compilationDatabase`: Dictionary with the following keys, defining options for workspaces with a compilation database |
| 23 | + - `searchPaths: string[]`: Additional paths to search for a compilation database, relative to a workspace root. |
| 24 | +- `fallbackBuildSystem`: Dictionary with the following keys, defining options for files that aren't managed by any build system |
| 25 | + - `cCompilerFlags: string[]`: Extra arguments passed to the compiler for C files |
| 26 | + - `cxxCompilerFlags: string[]`: Extra arguments passed to the compiler for C++ files |
| 27 | + - `swiftCompilerFlags: string[]`: Extra arguments passed to the compiler for Swift files |
| 28 | +- `clangdOptions: string[]`: Extra command line arguments passed to `clangd` when launching it |
| 29 | +- `index`: Dictionary with the following keys, defining options related to indexing |
| 30 | + - `indexStorePath: string`: Directory in which a separate compilation stores the index store. By default, inferred from the build system. |
| 31 | + - `indexDatabasePath: string`: Directory in which the indexstore-db should be stored. By default, inferred from the build system. |
| 32 | + - `indexPrefixMap: [string: string]`: Path remappings for remapping index data for local use. |
| 33 | + - `maxCoresPercentageToUseForBackgroundIndexing: double`: 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 |
| 34 | + - `updateIndexStoreTimeout: int`: Number of seconds to wait for an update index store task to finish before killing it. |
| 35 | +- `defaultWorkspaceType: "buildserver"|"compdb"|"swiftpm"`: Overrides workspace type selection logic. |
| 36 | +- `generatedFilesPath: string`: Directory in which generated interfaces and macro expansions should be stored. |
| 37 | +- `experimentalFeatures: string[]`: Experimental features to enable |
| 38 | +- `swiftPublishDiagnosticsDebounce`: The time that `SwiftLanguageService` should wait after an edit before starting to compute diagnostics and sending a `PublishDiagnosticsNotification`. |
0 commit comments