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

Optimistically show paste with imports if TS server takes to long when computing imports to add #239899

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Feb 7, 2025

Fixes #235959

When pasting across files, sometimes users can see a spinner while we wait to see if TS has a paste with imports edit. This needs to be done even if we insert plain text by default so that we can then show the paste widget and user can select paste with imports

This change makes it so that if TS takes over 200ms, we assume that a paste operation may be available and return an unresolved edit for it. Only when the edit then actually needs to be applied do we then wait for TS to respond

In most cases we won't need to wait because plain text will be pasted by default. Users will now only see the spinner after selecting paste with imports of if they have configured it as the default paste

The main downside is that we will now sometimes show paste with imports even if selecting it does not actually add any imports (this will happened when we timed out getting the initial edit and then during resolve we learn there was not a valid paste edit)

…hen computing imports to add

Fixes microsoft#235959

When pasting across files, sometimes users can see a spinner while we wait to see if TS has a `paste with imports` edit. This needs to be done even if we insert plain text by default so that we can then show the paste widget and user can select `paste with imports`

This change makes it so that if TS takes over 200ms, we assume that a paste operation may be available and return an unresolved edit for it. Only when the edit then actually needs to be applied, we wait for TS to respond

In most cases we won't need to wait because plain text will be pasted by default. Users will then only see the spinner after selecting `paste with imports`
@mjbvz mjbvz added this to the February 2025 milestone Feb 7, 2025
@mjbvz mjbvz self-assigned this Feb 7, 2025
@mjbvz mjbvz requested a review from jrieken as a code owner February 7, 2025 08:03
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

@mjbvz mjbvz enabled auto-merge February 7, 2025 08:15
@mjbvz mjbvz merged commit 18edce9 into microsoft:main Feb 7, 2025
7 checks passed
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.

Paste slow
2 participants