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

Avoid blocking folder addition on package loading #1422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

plemarquand
Copy link
Contributor

When a folder is added to a VSCode workspace the extension performs a swift package describe to load information about the package. This operation must complete before the folder is added to the workspaceContext. This prevents the user from taking many actions in the extension that could be made available right away. A swift package describe operation can potentially take a good amount of time if package resolution has not yet been performed.

Work around this limitation by wrapping the data pulled from this package describe behind promises, allowing clients to wait for package resolution to complete only if they need information that is gated by it.

This was tested with a large project (https://github.com/vapor/penny-bot) and I noticed the time until defined build tasks were made available improved by about ~7-10 seconds on a fresh open with an up to date .build folder. This is even faster on fresh checkout.

Issue: #1250

When a folder is added to a VSCode workspace we perform a `swift package
describe` to load information about the package. This operation must
complete before the folder is added to the `workspaceContext`, which
prevents the user from taking many actions in the extension that could
be made available right away. A `swift package describe` operation can
potentially take a good amount of time if package resolution has not
been performed.

Work around this limitation by wrapping the data pulled from this
`package describe` behind promises, allowing clients to wait for package
resolution to complete only if they need information that is gated by
it.

Issue: swiftlang#1250
@plemarquand plemarquand force-pushed the non-blocking-folder-resolution branch from e4cc8c9 to fa56bbf Compare March 5, 2025 02:09
@plemarquand plemarquand marked this pull request as ready for review March 5, 2025 18:47
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.

1 participant