Skip to content

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

Merged
merged 3 commits into from
May 22, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 22, 2024

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.

  • 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.

ahoppen added 3 commits May 21, 2024 22:09
…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.
@ahoppen ahoppen requested review from bnbarham and hamishknight May 22, 2024 05:30
@ahoppen ahoppen requested a review from benlangmuir as a code owner May 22, 2024 05:30
@ahoppen
Copy link
Member Author

ahoppen commented May 22, 2024

@swift-ci Please test

@ahoppen ahoppen changed the title Add a development subcommand to index a project 🚥 #1326 Add a development subcommand to index a project May 22, 2024
@ahoppen ahoppen merged commit 814f3c5 into swiftlang:main May 22, 2024
3 checks passed
@ahoppen ahoppen deleted the index-subcommand branch May 22, 2024 13:43
Copy link
Contributor

@hamishknight hamishknight left a 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,
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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).

Copy link
Member Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in -> on

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased entirely.

ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request May 24, 2024
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request May 24, 2024
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request May 25, 2024
ahoppen added a commit that referenced this pull request May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants