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

Paste with imports corrupts other parts of file #59539

Closed
mjbvz opened this issue Aug 5, 2024 · 1 comment
Closed

Paste with imports corrupts other parts of file #59539

mjbvz opened this issue Aug 5, 2024 · 1 comment
Assignees
Labels
Bug A bug in TypeScript

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Aug 5, 2024

πŸ”Ž Search Terms

  • paste imports

πŸ•— Version & Regression Information

5.6.0-dev.20240805

⏯ Playground Link

No response

πŸ’» Code

  1. Using a VS Code starter extension created with yo code
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import { log } from 'console';
import * as vscode from 'vscode';

// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

	// Use the console to output diagnostic information (console.log) and errors (console.error)
	// This line of code will only be executed once when your extension is activated
	console.log('Congratulations, your extension "test-ext" is now active!');

	


}

// This method is called when yvscode.our extension is deactivated
export function deactivate() { }
  1. Enable paste with imports
  2. paste the text vscode.window.createWebviewPanel() into the body of activate

πŸ™ Actual behavior

You end up with invalid code:

// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import { log } from 'console';
import * as vscode from 'vscode';

// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.vscode.ExtensionContext) {

	// Use the console to output diagnostic information (console.log) and errors (console.error)
	// This line of code will only be executed once when your extension is activated
	console.log('Congratulations, your extension "test-ext" is now active!');

	 vscode.window.createWebviewPanel()


}

//vscode. This method is called when yvscode.our extension is deactivated
export function deactivate() { }

Notice:

  1. context: vscode.vscode.ExtensionContext
  2. vscode. was randomly to the comment on deactivate

πŸ™‚ Expected behavior

Should just paste the text as no new imports are needed

Additional information about the issue

No response

@mjbvz mjbvz changed the title Paste with imports corrupts existing imports Paste with imports corrupts other parts of file Aug 5, 2024
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Aug 6, 2024
@mjbvz
Copy link
Contributor Author

mjbvz commented Oct 16, 2024

I can't repo this anymore. Will reopen with updated steps if I can

However I also don't see paste edits being applied at all in some cases. Opening new issue issue for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants