If a build server doesn’t specify -index-store-path in the SourceKit options, add it during background indexing

This commit is contained in:
Alex Hoppen
2025-02-25 14:25:05 -08:00
parent 1727a7bdf7
commit 628ce3cc63
6 changed files with 39 additions and 21 deletions

View File

@@ -24,10 +24,10 @@ import LanguageServerProtocol
#endif
func lastIndexStorePathArgument(in compilerArgs: [String]) -> String? {
for i in compilerArgs.indices.reversed() {
if compilerArgs[i] == "-index-store-path" && i + 1 < compilerArgs.count {
return compilerArgs[i + 1]
}
if let indexStorePathIndex = compilerArgs.lastIndex(of: "-index-store-path"),
indexStorePathIndex + 1 < compilerArgs.count
{
return compilerArgs[indexStorePathIndex + 1]
}
return nil
}