Detecting doc fails on Swift 3.0
Open
Nobody has claimed this yet.
bug
- Dominant language
- Swift
- Stars
- 2.4k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two sourcekitten structure --text examples with Swift 2.3 and Swift 3.0, then trace how SourceKitten detects documentation from those responses. Check the affected SwiftLint issue for expected behavior; done means documentation detection works with Swift 3.0 while preserving Swift 2.3 behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100