Skip to content

Merge main into release/6.0 #1324

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 59 commits into from
May 22, 2024

Conversation

yaroslavyaroslav and others added 30 commits April 18, 2024 13:40
Swift-Next syntax highlight added
When a header is modified, we don’t we want to re-index all main files that include it. Instead, we just want to index one main to effectively re-index the header itself.

I originally implemented re-indexing of all files that include the header but on second thought, headers are like Swift modules, where we also don’t re-index all dependencies either. And if you change a low-level header that’s included by the entire project, you probably don’t want the indexer to go off and re-index the entire project.
…-files

Don’t re-index all files that include a header when a header is modified
…hat are known to be up-to-date

Fixes swiftlang#1258
rdar://127475948
Whenever we get request for a document, open it or edit it, trigger a preparation of its target, but don’t block any interaction based on it. This should ensure that the target is usually prepared when the user is interacting with it.

We need to track the preparation status of targets somewhat accurately in `SemanticIndexManager`, so we don’t unnecessarily re-prepare a target. When updating the index store, it is acceptable to schedule another `UpdateIndexStoreTaskDescription` because it will early exit based on an `mtime` check with the unit file. Null builds of a target take significantly longer and thus we want to avoid them.

Fixes swiftlang#1252
rdar://127474003
…gets

When interacting with a document, prepare the target it belongs to
ahoppen and others added 22 commits May 17, 2024 14:16
The existing ad-hoc logic was not quite correct because it didn’t eg. remove `-MT/depfile` because it assumed that `-MT` was followed by a space. It also didn’t take into account that `serialize-diagnostics` can be spelled with a single dash or two dashes.

Create a `CompilerCommandLineOption` type that forces decisions to be made about the dash spelling and argument styles, which should help avoid problems like this in the future.
Add code actions for adding library/executable/macro targets to a package manifest
Don't re-prepare a target if there is already a smaller preparation task for it scheduled
Essentially fix two issues in updating the index store:
1. If there was one task to index `HeaderA.h` through `main.c` and one to index `HeaderB.h` through `main.c`, we would not declare a dependency between them in the task scheduler, which meant that we could have two concurrent and racing index tasks for `main.c`. Declare a dependency between any two files that have the same main file
2. `UpdateIndexStoreTaskDescription` was computing the target to index a file in independently of `SemanticIndexManager`. While they currently always line up, we should pass the target in which to index a file to the `UpdateIndexStoreTaskDescription`. Only this way can we guarantee that we actually prepared the target that the file will be indexed in.
The logging from `TaskScheduler` was really verbose (and somewhat useful during its development) but it turns out that it’s just noise in real-world debugging. So, let’s remove it.
…ogging

Remove status logging from `TaskScheduler`
…ilure

Fix non-deterministic test failure in `BackgroundIndexingTests.testPrepareTarget`
Move `LocalConnection` to `LSPTestSupport`
Generalize the removal of compiler argument options during indexing
…rgets-as-out-of-date

When a file is changed, only mark targets that depend on it as out-of-date
We were mixing the up-to-date status and in-progress status of an index task in `SemanticIndexManager`. This meant that a single `QueuedTask` in the task scheduler could be needed for eg. both preparation for editor functionality in a file of that target and to re-index a file in that target. This dual ownership made it unclear, which caller would be entitled to cancel the task. Furthermore, we needed to duplicate some logic from the preparation task dependencies in `SemanticIndexManager.prepare`.

To simplify things:
- Split the up-to-date status and the in-progress status into two different data structures
- Make the caller of `prepare` and `scheduleIndex` responsible for cancellation of the task it has scheduled. `TaskScheduler` might receive more scheduled tasks this way but the additional tasks should all be no-ops because the status is known to be up-to-date when they execute.
…ess-tracking

Split up-to-date status tracking and index progress tracking
# Conflicts:
#	Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift
@ahoppen ahoppen requested a review from bnbarham May 21, 2024 18:10
@ahoppen ahoppen requested a review from benlangmuir as a code owner May 21, 2024 18:10
@ahoppen
Copy link
Member Author

ahoppen commented May 21, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented May 21, 2024

@swift-ci Please test Windows

1 similar comment
@ahoppen
Copy link
Member Author

ahoppen commented May 21, 2024

@swift-ci Please test Windows

@ahoppen ahoppen merged commit 25a53c1 into swiftlang:release/6.0 May 22, 2024
3 checks passed
@ahoppen ahoppen deleted the 6.0/merge-main-2024-05-21 branch May 22, 2024 01:17
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.

6 participants