@@ -78,13 +78,13 @@ public final class Workspace {
78
78
rootUri: DocumentURI ? ,
79
79
capabilityRegistry: CapabilityRegistry ,
80
80
toolchainRegistry: ToolchainRegistry ,
81
- buildSetup : BuildSetup ,
81
+ options : SourceKitLSPServer . Options ,
82
82
underlyingBuildSystem: BuildSystem ? ,
83
83
index uncheckedIndex: UncheckedIndex ? ,
84
84
indexDelegate: SourceKitIndexDelegate ?
85
85
) async {
86
86
self . documentManager = documentManager
87
- self . buildSetup = buildSetup
87
+ self . buildSetup = options . buildSetup
88
88
self . rootUri = rootUri
89
89
self . capabilityRegistry = capabilityRegistry
90
90
self . uncheckedIndex = uncheckedIndex
@@ -117,36 +117,36 @@ public final class Workspace {
117
117
rootUri: DocumentURI ,
118
118
capabilityRegistry: CapabilityRegistry ,
119
119
toolchainRegistry: ToolchainRegistry ,
120
- buildSetup : BuildSetup ,
120
+ options : SourceKitLSPServer . Options ,
121
121
compilationDatabaseSearchPaths: [ RelativePath ] ,
122
122
indexOptions: IndexOptions = IndexOptions ( ) ,
123
123
reloadPackageStatusCallback: @escaping ( ReloadPackageStatus ) async -> Void
124
124
) async throws {
125
125
var buildSystem : BuildSystem ? = nil
126
126
127
- func createSwiftPMBuildSystem( rootUrl: URL ) async -> SwiftPMBuildSystem ? {
128
- return await SwiftPMBuildSystem (
129
- url: rootUrl,
130
- toolchainRegistry: toolchainRegistry,
131
- buildSetup: buildSetup,
132
- reloadPackageStatusCallback: reloadPackageStatusCallback
133
- )
134
- }
127
+ if let rootUrl = rootUri. fileURL, let rootPath = try ? AbsolutePath ( validating: rootUrl. path) {
128
+ func createSwiftPMBuildSystem( rootUrl: URL ) async -> SwiftPMBuildSystem ? {
129
+ return await SwiftPMBuildSystem (
130
+ url: rootUrl,
131
+ toolchainRegistry: toolchainRegistry,
132
+ buildSetup: options. buildSetup,
133
+ reloadPackageStatusCallback: reloadPackageStatusCallback
134
+ )
135
+ }
135
136
136
- func createCompilationDatabaseBuildSystem( rootPath: AbsolutePath ) -> CompilationDatabaseBuildSystem ? {
137
- return CompilationDatabaseBuildSystem (
138
- projectRoot: rootPath,
139
- searchPaths: compilationDatabaseSearchPaths
140
- )
141
- }
137
+ func createCompilationDatabaseBuildSystem( rootPath: AbsolutePath ) -> CompilationDatabaseBuildSystem ? {
138
+ return CompilationDatabaseBuildSystem (
139
+ projectRoot: rootPath,
140
+ searchPaths: compilationDatabaseSearchPaths
141
+ )
142
+ }
142
143
143
- func createBuildServerBuildSystem( rootPath: AbsolutePath ) async -> BuildServerBuildSystem ? {
144
- return await BuildServerBuildSystem ( projectRoot: rootPath, buildSetup: buildSetup)
145
- }
144
+ func createBuildServerBuildSystem( rootPath: AbsolutePath ) async -> BuildServerBuildSystem ? {
145
+ return await BuildServerBuildSystem ( projectRoot: rootPath, buildSetup: options . buildSetup)
146
+ }
146
147
147
- if let rootUrl = rootUri. fileURL, let rootPath = try ? AbsolutePath ( validating: rootUrl. path) {
148
148
let defaultBuildSystem : BuildSystem ? =
149
- switch buildSetup. defaultWorkspaceType {
149
+ switch options . buildSetup. defaultWorkspaceType {
150
150
case . buildServer: await createBuildServerBuildSystem ( rootPath: rootPath)
151
151
case . compilationDatabase: createCompilationDatabaseBuildSystem ( rootPath: rootPath)
152
152
case . swiftPM: await createSwiftPMBuildSystem ( rootUrl: rootUrl)
@@ -184,6 +184,7 @@ public final class Workspace {
184
184
var index : IndexStoreDB ? = nil
185
185
var indexDelegate : SourceKitIndexDelegate ? = nil
186
186
187
+ let indexOptions = options. indexOptions
187
188
if let storePath = await firstNonNil ( indexOptions. indexStorePath, await buildSystem? . indexStorePath) ,
188
189
let dbPath = await firstNonNil ( indexOptions. indexDatabasePath, await buildSystem? . indexDatabasePath) ,
189
190
let libPath = await toolchainRegistry. default? . libIndexStore
@@ -212,7 +213,7 @@ public final class Workspace {
212
213
rootUri: rootUri,
213
214
capabilityRegistry: capabilityRegistry,
214
215
toolchainRegistry: toolchainRegistry,
215
- buildSetup : buildSetup ,
216
+ options : options ,
216
217
underlyingBuildSystem: buildSystem,
217
218
index: UncheckedIndex ( index) ,
218
219
indexDelegate: indexDelegate
0 commit comments