Closed alkhimey closed 2 years ago
Out of interest, what version of Xcode/Swift? I haven't done any testing with Xcode 14.1 yet.
The crash line says, I think, that a decl in the json, probably for a Swift extension
is missing name
which isn't supposed to happen (must be an extension of some nominal type).
Would be great if you can share the json, but understand if you can't/don't want to. Would be more defensive against weird json from the compiler to check against this property being missing.
Hi,
Xcode version 13.4.1 When the JSON was produced with sourcekitten, I missed that it had ton of errors. Indeed the JSON has some weird results inside it.
Anyway, by elimination I was able to reduce it's size so I can just redact everything that is sensitive.
[
{
"" : {
"key.diagnostic_stage" : "Redacted",
"key.substructure" : [
{
"key.always_deprecated" : false,
"key.always_unavailable" : false,
"key.deprecation_message" : "",
"key.doc.column" : 12,
"key.doc.comment" : "Redacted",
"key.doc.file" : "Redacted",
"key.doc.full_as_xml" : "",
"key.doc.line" : 59,
"key.filepath" : "Redacted",
"key.kind" : "sourcekitten.source.lang.objc.decl.category",
"key.parsed_declaration" : "Redacted",
"key.parsed_scope.end" : 188,
"key.parsed_scope.start" : 59,
"key.substructure" : [
{
"key.always_deprecated" : false,
"key.always_unavailable" : false,
"key.deprecation_message" : "",
"key.doc.column" : 53,
"key.doc.comment" : "Redacted",
"key.doc.file" : "Redacted",
"key.doc.full_as_xml" : "",
"key.doc.line" : 185,
"key.filepath" : "Redacted",
"key.kind" : "sourcekitten.source.lang.objc.decl.property",
"key.name" : "redacted",
"key.parsed_declaration" : "Redacted",
"key.parsed_scope.end" : 185,
"key.parsed_scope.start" : 185,
"key.unavailable_message" : "",
"key.usr" : ""
}
],
"key.unavailable_message" : "",
"key.usr" : ""
}
]
}
}
]
Thanks a lot for tracking that down. I see it's a special case to do with Objective-C categories: sourcekitten has to figure out their key.name
from their USR, which doesn't exist if the compilation errors out.
So, if you get your ObjC sourcekitten
run working cleanly this should go away (some tips here if you need them) otherwise I think you'll have to manually knock out these json entries.
I'll add a fix on the jazzy side to cope with this bad json, but it's not localised to the method that crashed - the name is so important for organising things I think we'll have to just filter them out entirely and log a warning.
jazzy version: 0.14.3 Tried with multiple version of Ruby (2.6.10, 2.7.6, 3.1.2)