Skip to content

Commit b5d9652

Browse files
committed
Address review comments to swiftlang#1306
1 parent 7208376 commit b5d9652

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Documentation/Files_To_Reindex.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Alternatives would be:
1818

1919
## `.h`
2020

21-
Affects all files that include the header (including via other headers). For existing headers, we know which files import a header from the existing index. For new header files, we assume that it hasn’t been included in any file yet and so we don’t re-index any file. If it is, it’s likely that the user will modify the file that includes the new header file shortly after, which will re-index it.
21+
All files that include the header (including via other headers) might be affected by the change, similar to how all `.swift` files that import a module might be affected. Similar to modules, we choose to not re-index all files that include the header because of the same considerations mentioned above.
22+
23+
To re-index the header, we pick one main file that includes the header and re-index that, which will effectively update the index for the header. For existing headers, we know which files import a header from the existing index. For new header files, we assume that it hasn’t been included in any file yet and thus don't re-index it. If the header is included from somewhere lese, it’s likely that the user will modify the file that includes the new header file shortly after, which will index the header and establish the header to main file connection.
2224

2325
## `.c` / `.cpp` / `.m`
2426

Sources/LSPLogging/NonDarwinLogging.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,17 @@ public struct NonDarwinLogInterpolation: StringInterpolationProtocol, Sendable {
195195
append(description: message.description, redactedDescription: message.redactedDescription, privacy: privacy)
196196
}
197197

198+
public mutating func appendInterpolation(
199+
_ message: (some CustomLogStringConvertibleWrapper & Sendable)?,
200+
privacy: NonDarwinLogPrivacy = .private
201+
) {
202+
if let message {
203+
self.appendInterpolation(message, privacy: privacy)
204+
} else {
205+
self.appendLiteral("<nil>")
206+
}
207+
}
208+
198209
public mutating func appendInterpolation(_ type: Any.Type, privacy: NonDarwinLogPrivacy = .public) {
199210
append(description: String(reflecting: type), redactedDescription: "<private>", privacy: privacy)
200211
}

Sources/SemanticIndex/SemanticIndexManager.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,10 @@ public final actor SemanticIndexManager {
394394
// to index the low-level targets ASAP.
395395
var filesByTarget: [ConfiguredTarget: [FileToIndex]] = [:]
396396
for file in outOfDateFiles {
397-
guard let target = await buildSystemManager.canonicalConfiguredTarget(for: file.uri) else {
398-
logger.error("Not indexing \(file.uri.forLogging) because the target could not be determined")
397+
guard let target = await buildSystemManager.canonicalConfiguredTarget(for: file.mainFile ?? file.uri) else {
398+
logger.error(
399+
"Not indexing \(file.uri.forLogging) because the target could not be determined for main file \(file.mainFile?.forLogging)"
400+
)
399401
continue
400402
}
401403
filesByTarget[target, default: []].append(file)

0 commit comments

Comments
 (0)