-
Notifications
You must be signed in to change notification settings - Fork 314
Add a development subcommand to index a project #1329
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
…ets being prepared in the work done progress
This allows a user of SourceKit-LSP to inspect the result of background indexing. This allows a user of SourceKit-LSP to inspect the result of background indexing. I think this gives useful insights into what SourceKit-LSP is indexing and why/how it fails, if it fails, also for users of SourceKit-LSP. rdar://127474136 Fixes swiftlang#1265
This allows us to run `sourcekit-lsp index --project /path/to/project` to index a project. Intended to debugging purposes, eg. - Profile the time it takes to index a project - See if the project can be indexed successfully - Look at signposts generated during indexing in Instruments to see whether indexing or preparation is the bottleneck and how well we can parallelize tasks.
@swift-ci Please test |
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.
LGTM
nonisolated func indexTaskDidProduceResult(_ result: IndexProcessResult) { | ||
self.sendNotificationToClient( | ||
LogMessageNotification( | ||
type: result.failed ? .info : .warning, |
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.
Just for testing? I wouldn't expect this to be particularly uncommon (eg. half way through making an edit and you save).
Also is this meant to be result.failed ? .warning : .info
?
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.
Not sure if it was obvious but this sends a log notification to the client (it’s not about logging to OSLog). This will effectively generate a build log in the client that users can look at.
I’m not sure how much the log message type (info
vs warning
) actually ends up influencing the client’s representation but my idea was that showing the file preparation / indexstore update jobs as a warning when it failed because it could indicate that something went wrong. The failed index tasks are certainly more interesting than those that succeeded, I think.
And yes, looks like I flipped them.
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.
Yeah, I got this was client. Just wasn't sure where in the client (was mostly worried this was a popup). If it's just an extra build log, that seems fine (other than that they are switched).
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.
It shouldn’t be a popup, just a log.
@Flag( | ||
help: """ | ||
Show which index tasks are currently running in the indexing work done progress. \ | ||
This produces a multi-line work done progress, which might render incorrectly depending in the editor. |
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.
in
-> on
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.
Rephrased entirely.
Contains changes from #1326
This allows us to run
sourcekit-lsp index --project /path/to/project
to index a project. Intended to debugging purposes, eg.