Skip to content

Merge main into release/6.0 #1364

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 35 commits into from
May 29, 2024

Conversation

ahoppen and others added 30 commits May 23, 2024 14:03
We used to only watch for file creation and deletion because that might modify build settings but for background indexing, we also need to watch for changes to the files, so we can invalidate the up-to-date status of the target.
Turns out that some of logging from task scheduler would have been useful to debug a recent test failure. This adds some logging into `TaskScheduler` again and, most importantly, adds log messages to `ClosureTaskDescription` in `TaskSchedulerTests`.
…heduler`

We need this function anyway to escalate process priorities when we set `nice`ness values for them. It also simplifies the task scheduler and I’m hoping that it fixes a non-deterministic failure that causes task priority elevation to not work properly.
… doesn’t support task priority elevation
…changes

Watch for changes to source files
…rce files we need to re-index

Waiting for the indexstore-db to be updated is cheaper than potentially not knowing about unit files, which causes the corresponding source files to be re-indexed.

rdar://128645743
Otherwise, we will never show the progress again.
Removes a step to copy paste the bundle path to find it in Finder.
…efore-deciding-what-to-index

Ensure that the indexstore-db is up-to-date before deciding which source files we need to re-index
…-state

Reset the state of `WorkDoneProgressState` when the progress has ended
…ild graph

Rebuilding the build graph can take a while (initial loading of the build graph takes ~7s for sourcekit-lsp) and it’s good to show some progress during this time.
The signposts aren’t easily visible in the log (you need to add `--signpost` to `log show`) and don’t get logged on non-Darwin platforms at all. Add logging for it.
On macOS, reveal diagnostic bundle in Finder after it has been created
Add some logging to `TaskScheduler` again
Swift packages can have source files that we can’t index (like assembly files). When re-opening, we schedule indexing for those files, which requires the targets to be re-prepared. We skip them earlier.

rdar://128711633
Set `cancelBuilds` to 0 on close instead of open
…he SourceKitLSPServer are modified

`IndexProgressManager` iterates over all workspaces in the SourceKitLSPServer. Modifying workspaces might thus update the index progress status.
…tor functionality

While `SemanticIndexManager.inProgressPrepareForEditorTask` is not `nil`, show a work done progress in the editor that the current file is being prepared for editor functionality.

I decided to use the indexing progress indicator for this for now because I think it’s too spammy if SourceKit-LSP has two different progress indicators for preparation and indexing. I’ll need to see how this feels like in practice.

rdar://128722609
Fix two issue:
1. If a task’s priority got elevated, we would emit the `Elevating priority` log message repeatedly until the elevated priority is propagated to the underlying task via `withTaskPriorityChangedHandler`
2. Explicitly set the priority of `QueuedTask`, which ensures that we create the detached `resultTask` inside of it with that priority. I’m not sure if this was an actual issue but seems like a good cleanup regardless.
Don’t re-index files in languages that cannot be indexed
The file was a little large and contained multiple types that can easily be split off. Now you can scroll to the top of the file and see the members of `SourceKitLSPServer`.
Time out updating of the index store after 2 minutes. We don't expect any single file compilation to take longer than 2 minutes in practice, so this indicates that the compiler has entered some kind of loop. We will try indexing the file again when it is edited or when the project is re-opened.

rdar://128732571
Diagnostics are usually not helpful if the file’s target hasn’t been prepared yet. We should await the target’s preparation before returning diagnostics.

rdar://128645617
…ments

A couple minor priority elevation bug fixes in `TaskScheduler`
Split SourceKitLSPServer.swift into multiple files
…rent-file-preparation

Show work done progress while a source file is being prepared for editor functionality
Time out updating the index store after 2 minutes
…cit workspace for a file

When looking for a workspace that can handle a file, we were creating full-fledged workspaces along the way, which we would then discard if they couldn’t handle the file being opened. This had multiple problems:
1. When background indexing is enabled, it caused semantic indexing of the workspace, which wrote files to a `.index-build` directory and was a waste of work
2. When background indexing is enabled, it caused package resolution, which also created a `.index-build` folder to be created
3. It caused a syntactic test index of the workspace, which was a waste of work.

To fix this, do multiple things:
1. When creating a workspace, add a check right after build system creation. This allows us to early exit if the build system can’t handle the file and prevents us from generating the `Workspace`, fixing (1) and (3)
2. Don’t call `reloadPackage` when creating a `SwiftPMWorkspace`. Instead, explicitly call `generateBuildGraph` once we committed to creating the workspace.
ahoppen and others added 5 commits May 28, 2024 09:21
…efore-diags

Wait for target to be prepared before returning diagnostics
…earching-for-workspace

Don’t cause any file system file effects when trying to find an implicit workspace for a file
Fix a test build issue due to PRs racing
# Conflicts:
#	Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift
@ahoppen ahoppen requested a review from bnbarham May 28, 2024 18:51
@ahoppen ahoppen requested a review from benlangmuir as a code owner May 28, 2024 18:51
@ahoppen
Copy link
Member Author

ahoppen commented May 28, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit 778678f into swiftlang:release/6.0 May 29, 2024
3 checks passed
@ahoppen ahoppen deleted the 6.0/merge-main-2024-05-28 branch May 29, 2024 00:29
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