jpsim / SourceKitten

An adorable little framework and command line tool for interacting with SourceKit.
MIT License
2.31k stars 226 forks source link

did not find primary SourceFile #662

Open iMostfa opened 4 years ago

iMostfa commented 4 years ago

i have a problem when making a request using the framework: here's my code: `

let file = File(path: "/Users/username/Downloads/file.swift")!
let request  = SourceKittenFramework.Request.cursorInfo(file: "/Users/mostfa/Downloads/file.swift", offset: (90), arguments: [file.path!])
let cursorInfo = try  request.send()

print(cursorInfo)

`

and the response i get is {"error":true,"reason":"did not find primary SourceFile"}

i tried to google it, but didn't find an answer :(

file path is correct, and the structure for same file is generated as expected, can anyone help me with this ? thank you very much

kristiinara commented 4 years ago

Have you found a solution? I'm running into the same problem after an XCode update.

iMostfa commented 3 years ago

Have you found a solution? I'm running into the same problem after an XCode update.

Unfortunately, no

johnfairh commented 3 years ago

SourceKit has required an explicit SDK for CursorInfo for a few Swift releases now.

So you need to include "-sdk", "/path/to/sdk" in the args.

Yes, the error response from SourceKit is misleading.

kristiinara commented 3 years ago

I had the same problem with the index request, but have both sdk and target specified. Could there be some additional argument that needs to be specified?