Skip to content

Don’t index files with fallback build settings #1418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,17 @@ public struct UpdateIndexStoreTaskDescription: IndexTaskDescription {
logger.error("Not indexing \(file.forLogging) because it has no compiler arguments")
return
}
if buildSettings.isFallback {
// Fallback build settings don’t even have an indexstore path set, so they can't generate index data that we would
// pick up. Also, indexing with fallback args has some other problems:
// - If it did generate a unit file, we would consider the file’s index up-to-date even if the compiler arguments
// change, which means that we wouldn't get any up-to-date-index even when we have build settings for the file.
// - It's unlikely that the index from a single file with fallback arguments will be very useful as it can't tie
// into the rest of the project.
// So, don't index the file.
logger.error("Not indexing \(file.forLogging) because it has fallback compiler arguments")
return
}
guard let toolchain = await buildSystemManager.toolchain(for: file.mainFile, language) else {
logger.error(
"Not updating index store for \(file.forLogging) because no toolchain could be determined for the document"
Expand Down