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

Test copy paste to update imports in js/ts #235016

Closed
3 tasks done
mjbvz opened this issue Dec 2, 2024 · 3 comments
Closed
3 tasks done

Test copy paste to update imports in js/ts #235016

mjbvz opened this issue Dec 2, 2024 · 3 comments

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Dec 2, 2024

Test for #30066

Complexity: 3

Create Issue


Overview

This iteration we enabled smart copy/pasting that also updates js/ts imports on paste. This was previously gated behind an experimental setting For this test plan item, test the edits this feature generates along with the UX for how this feature is presented to users

Testing

Basic flow

  • Try copy and pasting between two TS or JS files that are in the same project

    When you copy code that contains imported symbols, confirm that pasting it shows a paste widget. Selecting paste with imports in the paste widget should add the import

  • Try copying and pasting different types of code across different files. Confirm that reasonable edits are generated when using paste with imports

Configuration

  • Confirm you can use typescript.updateImportsOnPaste.enabled / javascript.updateImportsOnPaste.enabled to fully disable the feature

    With the feature disabled you should not see the paste widget when pasting

  • You can use settings to make paste with imports the default:

    • Edit the editor.pasteAs.preferences setting
    • Confirm you get intellisense for the various paste types. Specifically you should see text.updateImports.jsts listed
    • Add either text.updateImports.jsts or just text.updateImports to the preferences list
    • Now when pasting, paste with imports should be the default but you can use the paste widget to switch back to normal pasting

Known limitations

  • Smart copy paste currently only works within text editors in the same editor window
@alexr00
Copy link
Member

alexr00 commented Dec 3, 2024

Blocked on #235096

@sandy081 sandy081 removed their assignment Dec 3, 2024
@osortega
Copy link
Contributor

osortega commented Dec 3, 2024

@mjbvz I tested on windows and the only feedback that I have is that I wonder if we should detect if the import already exists and prevent a duplicated import, but not sure if that is out of scope.
Also, looks like the import got inserted in between a comment.

Example:
Image

@mjbvz
Copy link
Collaborator Author

mjbvz commented Dec 3, 2024

Thanks @osortega. This bug should track that: microsoft/TypeScript#60419

@osortega osortega removed their assignment Dec 3, 2024
@alexr00 alexr00 removed their assignment Dec 4, 2024
@alexr00 alexr00 closed this as completed Dec 4, 2024
This was referenced Dec 19, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants