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
[SourceKit] Cancel in-flight builds on editor.close
#73323
Conversation
// Then remove the cached AST if we've been asked to do so. | ||
if (RemoveCache) | ||
Removed->removeCachedAST(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any point to not removing from the cache if we never re-use it anyway? Or is there some case where it is re-used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we probably ought to re-use if the file contents matches after a close/open, but don't currently. I am planning on putting up a patch for that, but I suppose we could unconditionally remove for the time being.
There were a couple of accesses not guarded by `CacheMtx`, introduce a couple of methods that guard them, renaming `getASTProducer` while here. Also make sure we don't ever insert a producer after it has been purposefully removed by e.g a close that removes the cached AST.
And move this into the constructor since it only needs doing once.
This doesn't seem to be required by any of the tests using it.
When closing a document, cancel any in-flight builds happening for it. rdar://127126348
aaa8fc0
to
e51fac9
Compare
After talking with @ahoppen, updated to use an opt-in flag for this behavior |
editor.close
editor.close
Defaults to `true`.
e51fac9
to
de9806e
Compare
After further discussion, flipped the default back to |
@swift-ci please test |
@swift-ci please build toolchain |
editor.close
editor.close
When closing a document, cancel any in-flight builds happening for it.
rdar://127126348