SourceKitten
SourceKitten copied to clipboard
Detecting doc fails on Swift 3.0
This is caused by difference of response from SourceKit between Swift 2.3 and Swift 3.0.
Swift 3.0 does not return "key.attribute" : "source.decl.attribute.__raw_doc_comment".
Swift 2.3:
$ TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 sourcekitten structure --text "
/// docs
public func a() {}
"
{
"key.substructure" : [
{
"key.kind" : "source.lang.swift.decl.function.free",
"key.offset" : 17,
"key.attributes" : [
{
"key.attribute" : "source.decl.attribute.__raw_doc_comment"
}
],
"key.nameoffset" : 22,
"key.namelength" : 3,
"key.bodyoffset" : 27,
"key.bodylength" : 0,
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.length" : 11,
"key.name" : "a()"
}
],
"key.offset" : 0,
"key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
"key.length" : 29
}
Swift 3.0:
$ TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault sourcekitten structure --text "
/// docs
public func a() {}
"
{
"key.substructure" : [
{
"key.kind" : "source.lang.swift.decl.function.free",
"key.offset" : 17,
"key.nameoffset" : 22,
"key.namelength" : 3,
"key.bodyoffset" : 27,
"key.bodylength" : 0,
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.length" : 11,
"key.name" : "a()"
}
],
"key.offset" : 0,
"key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
"key.length" : 29
}
Affected issue: https://github.com/realm/SwiftLint/issues/728
Oh that sucks. I wonder why that was removed 😞
Yeah, then this is blocking https://github.com/realm/SwiftLint/pull/832 by failing tests.
https://bugs.swift.org/browse/SR-2487