-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any idea why source kit is throwing this error - ASTInvocation problem ? #697
Comments
Just what the message says really: it means Swift thinks that the source file you are querying ( If you think your keys are consistent then you should take a full example to bugs.swift.org. |
So, this is not something being compiled, but parsed by source kit - it feels like something wrong with the source, something it does not understand, like SwiftUI or something new it cant comprehend. |
How can you catch this error during this parsing process |
No, nothing at all to do with "the parsing process", it's about the keys in your sourcekit request per my previous comment. |
So, when source kit starts to analyze the source in a project, it encounters a file it did not get passed for compilation. Not sure I fully understand how source kit is doing its thing, but if it is acting on files in a project, using SourceKitten, is it compiling the source in order to obtain the key and structure data ? |
The compiler args are supplied by the user or taken from the build tool CLI/record. If you are not making sourcekit requests directly, can you explain exactly which sourcekitten interface you are using when you see this problem? If you are running |
/*
* get stucture for a source file
*/
func getStructure(filePath :String) -> Structure?
{
var structure : Structure
do
{
structure = try Structure(file: File(path: filePath)!)
return structure
}
catch let error
{
logger.logError(message: "getStructure - error: \(error.localizedDescription)")
}
return nil
} |
None of that sends a cursorInfo request. If you have a source file that causes the cursorInfo error from the OP when you run that |
Maybe I dont understand what SourceKitten is doing - when it does interact with SourceKit, is it in fact compiling things, and that this is necessary to obtain structure and other artifacts ? If not, I see that in SourceKit itself, it is indeed getting this error here: Utils.cpp - gets initCompilerInvocation invoked, which in turn calls resolveSymbolicLinksInInputs resolveSymbolicLinksInInputs is the method throwing that error: OS << "'" << PrimaryFile << "' is not part of the input files"; So ... if SourceKitten is calling SourceKit to do its thing, that sounds like a bug in SourceKitten ? |
SourceKit runs various phases of the compiler to implement the requests you send through SourceKitten. Your OP suggests SourceKit was sent a CursorInfo request. Your code could be sending this directly, or using SourceKitten's docs generation APIs ( If you are using SourceKitten's end-to-end docs generation via a different |
I took out the call to get documentation .. and I have a lot fewer errors as shown earlier. /*
* get comments / docs for a source file
*/
func getDoc(filePath :String) -> [String: SourceKitRepresentable]
{
var args = [String]()
args.append("single-file")
let docs = SwiftDocs(file: File(path: filePath)!, arguments: args)
return docs!.docsDictionary
} This used to work without issue (not all issues as described earlier), but now, some, not all, shoot out tons of error messages about ASTInvocation. Is this call not correct ? |
The
SourceKitten passes them through to SourceKit without touching them. |
sourcekit: [1:getCursorInfo: 0.0000] failed to create an ASTInvocation: '/home/ubuntu/dev/swift/SourceKittenUtil/temp/AnishaApril26/AnishaApril26-master/AnishaProduct/ContentView.swift' is not part of the input files
Have seen this on a number of files, and the files exist and appear to be valid structs, or class files.
The text was updated successfully, but these errors were encountered: