swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.3k stars 273 forks source link

Show protocol requirements satisfied in extensions in jump-to-definition #1464

Closed ahoppen closed 3 months ago

ahoppen commented 3 months ago

The key issue here was that we were looking at the symbol occurrence that had the overrideOf role and were using this symbol occurrence to also check that it’s a child of one of the receiver types. But if the protocol requirement is satisfied in an extension, we have an implicit symbol occurrence at the location where the protocol requirement is stated but the real declaration’s occurrence is inside the extension. The fix here is to just extract the USR from the overrideOf relation and then do another index lookup to find the symbol’s definition.

rdar://129412428

ahoppen commented 3 months ago

@swift-ci Please test

ahoppen commented 3 months ago

@swift-ci Please test

ahoppen commented 3 months ago

@swift-ci Please test Windows