-
Notifications
You must be signed in to change notification settings - Fork 314
Instead of sending a message to the index log when an indexing task finishes, stream results as they come in #1382
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
Conversation
@swift-ci Please test |
@swift-ci Please test |
@swift-ci Please test Windows |
The `showActivePreparationTasksInProgress` didn’t turn out to be terribly useful and with the streaming index log (swiftlang#1382), we should have the functionality to view which index tasks are currently running. So, we should remove the feature. rdar://129109830
The `showActivePreparationTasksInProgress` didn’t turn out to be terribly useful and with the streaming index log (swiftlang#1382), we should have the functionality to view which index tasks are currently running. So, we should remove the feature. rdar://129109830
logMessageToIndexLog: { taskID, message in | ||
self.logMessageToIndexLog(taskID: taskID, message: message) |
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.
No weak self
?
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.
Also, should have made this comment sooner, but should we consider using a delegate or something to cut down on the amount of closures we have to pass around?
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’m not a fan of delegates for exactly the weak self
reason. If this becomes a delegate then it’s the responsibility of Workspace
to decide whether self
(or the delegate) should be captured strongly or weakly. But I think that decision should be made on every call-side.
|
||
private func handleDataFromPipeImpl(_ newData: Data) { | ||
self.buffer += newData | ||
while let newlineIndex = self.buffer.firstIndex(of: UInt8(ascii: "\n")) { |
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.
Scanning the whole buffer every time doesn't seem ideal, but I guess lines aren't that long in practice?
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.
Yes, the expectation is that lines aren’t long and I can’t think of common scenarios where you get less than a full line from a pipe.
@@ -931,8 +947,8 @@ extension SourceKitLSPServer { | |||
options: options, | |||
indexOptions: self.options.indexOptions, | |||
indexTaskScheduler: indexTaskScheduler, | |||
indexProcessDidProduceResult: { [weak self] in | |||
self?.indexTaskDidProduceResult($0) |
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 indexTaskDidProduceResult
unused now?
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.
Oh, yes. Thanks for catching! Could also remove IndexProcessResult
now.
5af1e0c
to
90f1f2f
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
…inishes, stream results as they come in This also means that you can use the index log to view which tasks are currently being executed. Since we only have a single log stream we can write to, I decided to prefix every line in the index log with two colored emojis that an easy visual association of every log line to the task that generated them.
@swift-ci Please test |
@swift-ci Please test Windows |
@swift-ci Please test macOS |
This also means that you can use the index log to view which tasks are currently being executed.
Since we only have a single log stream we can write to, I decided to prefix every line in the index log with two colored emojis that an easy visual association of every log line to the task that generated them.
This is how an index log now looks like in VS Code