Skip to content
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

Merge main into release/6.0 #1301

Merged
merged 68 commits into from
May 15, 2024

Conversation

ahoppen and others added 30 commits May 5, 2024 14:26
Implements an initial background index when the project is opened.

The following will be implemented in follow-up PRs:
- Resolving package dependencies
- Preparing dependent modules
- Watching for file updates
Windows has `ProcessResult.ExitStatus.abnormal` instead of ` `ProcessResult.ExitStatus.signalled`
…ildSystem` has build settings for

Previously, `SwiftPMBuildSystem` would report `.unhandled` as the file handling capability for `Package.swift`. In single workspace-folder setups, this was not an issue because we would always default to using the build system of the first/only workspace folder, which was the only `SwiftPMBuildSystem` and then returned compiler arguments despite saying that it couldn’t handle `Package.swift`.

This, however, breaks if you have a setup with multi workspace folders, where we can’t rely on the first workspace folder being able to provide build settings for the package manifest.

To fix this, report `.handled` file handling capability for all files that `SwiftPMBuildSystem` can compute build settings for.

Fixes swiftlang#1210
rdar://127351614
`ModulesGraph.init` was changed by swiftlang/swift-package-manager#7530
to accept `packages` as a way to avoid having to recompute the full
list of packages by walking roots.
Merge the XCTests and swift-testing tests defined in extensions into
their parent TestItems.

This is done as another pass after the TestScanner visitors have walked
the tree.

Fixes swiftlang#1218
Sort the list of test items prioritizing those defined in the
originating type definition over those in extensions.
Return `fileHandlingCapability.handled` for all files that `SwiftPMBuildSystem` has build settings for
Implement initial background indexing of a project
I forgot to push these changes before merging the original PR.
…hange

Adopt SwiftPM ModulesGraph initializer API adjustment
Addresses a few minor comments and the following major ones:
- Add test cases for the syntax refactorings
- Don’t report code actions for refactorings that don’t actually modify the source
- Instead of just looking at the parent of the token of the selected range, walk up the syntax tree to find the syntax node to refactor. This makes the refactorings available in a lot more locations.
…eclaration’s trivia

This meant that if there were two newlines before the declaration, the documentation would be separated to the declaration by one newline and if the declaration was at the start of a line, the declaration would be on the same line as the doc comment, effectively making the documentation part of a comment.
Instead of asking for build settings of a file, the build system manager asks for the targets of a file and then asks for the build settings of that file in a specific target. This has two advantages:
- We know about targets and can prepare the targets for background indexing
- Once we support build systems in which a single file can be part of multiple targets, we can have a centralized place that picks preferred targets for a file, eg. based on user configuration
Fix PR comments to bug report issue template
Details from swiftlang#1271

> Amazon Linux 2 and CentOS 7 have a glibc that doesn’t support `posix_spawn_file_actions_addchdir_np` and thus `TSCBasic.Process` can’t launch a process on these platforms with the working directory set. We currently fall back to launching the index tasks without a working directory on these platforms, which I think is fine because SwiftPM gives us compiler arguments with absolute paths. But we should figure something out.
>
> Using `Foundation.Process` is not an option because it runs `chdir` on the current process for Posix platforms, which is racy if there are multiple subprocesses being spawned simultaneously. On Windows `TSCBasic.Processs` uses `Foundation.Process` and `Foundation.Process` properly set the working directory of the subprocesses on Windows, so Windows is not a problem.

rdar://127797048
Introduce a notion of `ConfiguredTargets` into the build system
Fall back to launching subprocesses without a working directory
ahoppen added 20 commits May 14, 2024 06:14
…6-mode

Make the `SourceKitLSP` module build in Swift 6 mode
This fixes a bug where `indexTaskDidFinish` would also get called when a task is cancelled to be rescheduled.
…lback

This follows the general paradigm that callbacks shouldn’t carry much state and instead only notify an observer that state has changed, which the observer can then poll.
…an be executed before SourceKit-LSP is initialized
This makes it a lot easier to work on background indexing because you can easily see how background indexing is making progress.

Resolves swiftlang#1257
rdar://127474057
…>=5.11)`

Fixes a build failure when building SourceKit-LSP using Xcode 15.4.
This allows me to test background indexing more easily locally as it matures. It is still experimental and may contain bugs.

Fixes swiftlang#1256
rdar://127474761
The fact that they are coming from a service named `sourcekitd` should be an implentation detail of SourceKit-LSP and shouldn’t be exposed to users. Use the generic `SourceKit` term, which is vague about which SourceKit the diagnostics are coming from.
Add a work done progress that shows the index progress
Guard `@retroactive` for `CommandConfiguration` behind `#if compiler(>=5.11)`
…exing-command-line-flag

Add a command-line option to enable background indexing
Change compiler’s diagnostic provider name to `SourceKit`
@ahoppen ahoppen requested a review from bnbarham May 14, 2024 22:46
@ahoppen ahoppen requested a review from benlangmuir as a code owner May 14, 2024 22:46
@ahoppen
Copy link
Member Author

ahoppen commented May 14, 2024

@ahoppen
Copy link
Member Author

ahoppen commented May 15, 2024

@swift-ci Please test macOS

@ahoppen
Copy link
Member Author

ahoppen commented May 15, 2024

swiftlang/swift-package-manager#7562

@swift-ci Please test macOS

@ahoppen
Copy link
Member Author

ahoppen commented May 15, 2024

swiftlang/swift-package-manager#7562

@swift-ci Please test Linux

@ahoppen ahoppen changed the title Merge main into release/6.0 🚥 swift-package-manager#7562 Merge main into release/6.0 May 15, 2024
@ahoppen ahoppen merged commit 8e5736d into swiftlang:release/6.0 May 15, 2024
3 checks passed
@ahoppen ahoppen deleted the 6.0/merge-main-2024-05-14 branch May 15, 2024 13:10
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