Why navigating to protocol var definition doesn't work ?

Hello Xcode users,


I'm stuck with a weird editor behavior.


For example let's have those two files in a macOS Cocoa app :


Protocols.swift

//
//  Protocols.swift
//  testprotocoldefinition
//

import Foundation

protocol Test {
    var isSetVar:Bool {get}
    func isSetFunc() -> Bool
}


Implementations.swift

//
//  Implementations.swift
//  testprotocoldefinition
//

import Foundation

class Implementation : Test {
    var isSetVar: Bool = true
    
    func isSetFunc() -> Bool {
        return true
    }
}


When I do Navigate > Jump to Definition, or ctrl + cmd + click, or ctrl + cmd + J :

- on Test.isSetFunc, Xcode opens a popover where you can navigate to Test.isSetFunc or Implementation.isSetFunc, as expected

- on Test.isSetVar, nothing happens

- on Implementation.isSetFunc, Xcode navigate to Test.isSetFunc, as expected

- on Implementation.isSetVar, nothing happens.


Odd thing is when I try to Refactor > Rename... on Test.isSetVar,

Implementation.isSetVar is also selected to be refactored.

That means indexer does the job as expected.


Is it a known issue all developers can reproduce ?


How do you figure out to navigate from protocol vars to their implementations in the editor ?


I'm using Xcode 10.1 on macOS 10.14

I was experiencing this in Xcode 10.0 too


Thank you for your help


Kind regards


Maxime

Accepted Reply

Bug filed 47283015 on bugreport and openradar

Replies

Yes, I can reproduce (tested on IOS App, but that does not make a difference).


Seems the var is not seen in the protocol part.


But on the delegate side, if you write


let testValue = delegate?.isSetVar


then cmd-click let you jump, with a pop up. But both choices lead to definition, never to implementation.


Should file a bug.

Bug filed 47283015 on bugreport and openradar