[swift-dev] SourceKit limits on Swift refactoring

肇鑫 owenzx at gmail.com
Sat Jan 9 15:15:47 CST 2016

There is a new Swift refactoring plugin
<https://github.com/johnno1962/Refactorator> for Xcode. It is developed
by johnno1962.

Tonight I have a conversation with him on an issue of the refactoring
plugin. The issue <https://github.com/johnno1962/Refactorator/issues/3> is
closed because johnno1962 says the issue is the limit of SourceKit, which
he can do nothing further.

So I bring it here and see if anyone can help.

The example is simple. Supposing we have code like this:

struct Person {
    var name:String

    init(aName:String) {
        self.name = aName
func testOnly() {
    let john = Person(aName: "John")


​When we do a refactor on aName, in ​let john = Person(aName: "John").
SourceKit only find this line of code and the code line init(aName:String).

It should also find the code line: self.name = aName, which it didn't.

According to johnno1962, SourceKit treats the aName inside the
init(aName:String) as a variable different from the aName in


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160110/8abe3db8/attachment.html>

More information about the swift-dev mailing list