Open dylansturg opened 1 year ago
The semantic data for the reference exists when requesting cursor-info
instead of the index for the whole instead.
$ sourcekitd-test -req cursor -offset 60 User.swift -- \
-sdk /var/db/xcode_select_link//Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk \
-target x86_64-apple-ios15.0-simulator \
-Xcc -fmodule-map-file=[path to your module map] \
User.swift
{
key.kind: source.lang.swift.ref.var.instance,
key.name: "propertyInProtocol",
key.usr: "c:objc(pl)Additions(py)propertyInProtocol",
key.line: 6,
key.column: 35,
key.receivers: [
{
key.usr: "c:objc(cs)BaseClass"
}
],
key.is_dynamic: 1,
key.offset: 123,
key.length: 18,
key.typename: "Any?",
key.typeusr: "$sypSgD",
key.containertypeusr: "$sSo9BaseClassCD",
key.modulename: "Objc_Base",
key.reusingastcontext: 0,
key.decl_lang: source.lang.objc,
key.is_synthesized: 1
}
It looks like the semantic data for this also exists, and just isn't getting into the response from index
or the output of building with indexing.
Description When a Swift file references a property on an Objective-C type where:
Then the SourceKit index and indexstore data contain no reference to that property in the Swift file. It appears like the property's use doesn't exist in the Swift file.
As an example of the coding pattern, consider these files:
Objc Class:
Objc Protocol & Category
When some Swift code uses
-[SomeClass foo]
, there's no corresponding reference in the index data.Steps to reproduce
Create an Objective-C module for use from Swift, containing these two files:
Class header:
Protocol header:
And a module map (for compilation):
Create a Swift file to use the Objective-C class:
Run sourcekitd-test to index the Swift file and observe the
entities
output:The
entities
does not contain any references topropertyInProtocol
.Expected behavior
I expect to see a reference to the property
propertyInProtocol
because it was used in the Swift code.Environment