Skip to content

Format selection (and thus format-on-paste) causes destructive edits #50076

Closed
@richardbullin

Description

@richardbullin

Issue Type: Bug

Create a simple template string in a Javascript or Typescript file as below

const TEST_STRING = `${TEST_VAR_1}, this is some text`; 

Copy any text and paste anywhere after the closing expression bracket "}". All text including the last "}" is deleted.

In my example I've copied the word "TEST_STRING " by double clicking on it. I've tried pasting just before the end back tick

const TEST_STRING = `${TEST_VAR_1; 

If you press undo the expected initial result is shown.

const TEST_STRING = `${TEST_VAR_1}, this is some textTEST_STRING`; 

VS Code version: Code 1.69.2 (3b889b090b5ad5793f524b5d1d39fda662b96a2a, 2022-07-18T16:12:52.460Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

Extensions: none

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions