Skip to content

Commit a643749

Browse files
committed
Log an error if we couldn't find the definition of a USR in the index
1 parent 2cc272e commit a643749

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SourceKitLSP/SourceKitLSPServer.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,11 @@ fileprivate extension CheckedIndex {
24712471
/// If the USR has an ambiguous definition, the most important role of this function is to deterministically return
24722472
/// the same result every time.
24732473
func primaryDefinitionOrDeclarationOccurrence(ofUSR usr: String) -> SymbolOccurrence? {
2474-
return definitionOrDeclarationOccurrences(ofUSR: usr).sorted().first
2474+
let result = definitionOrDeclarationOccurrences(ofUSR: usr).sorted().first
2475+
if result == nil {
2476+
logger.error("Failed to find definition of \(usr) in index")
2477+
}
2478+
return result
24752479
}
24762480
}
24772481

0 commit comments

Comments
 (0)