-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
π Search Terms
getPasteEdits
- Paste with imports
π Version & Regression Information
5.6.0-dev.20240619
β― Playground Link
No response
π» Code
a.ts
export interface Foo { }
export const foo: Foo = {}
- On line 3, copy
Foo
- Paste into a file
b.ts
at the|
(notice the blank lines before and after):
|
π Actual behavior
The returned edits are at the same location:
{"seq":0,"type":"response","command":"getPasteEdits","request_seq":166,"success":true,"performanceData":{"updateGraphDurationMs":1.7999577522277832},"body":{"edits":[{"fileName":"/Users/matb/projects/sandbox/b.ts","textChanges":[{"start":{"line":1,"offset":1},"end":{"line":1,"offset":1},"newText":"import { Foo } from \"./a\";\n"},{"start":{"line":1,"offset":2},"end":{"line":1,"offset":2},"newText":"Foo"}]}],"fixId":"providePostPasteEdits"}}
Info 567 [13:03:44.720] request:
{
"seq": 167,
"type": "request",
"command": "updateOpen",
"arguments": {
"changedFiles": [
{
"fileName": "/Users/matb/projects/sandbox/b.ts",
"textChanges": [
{
"newText": "import { Foo } from \"./a\";\n",
"start": {
"line": 1,
"offset": 1
},
"end": {
"line": 1,
"offset": 1
}
},
{
"newText": "Foo",
"start": {
"line": 1,
"offset": 1
},
"end": {
"line": 1,
"offset": 1
}
}
]
}
],
"closedFiles": [],
"openFiles": []
}
}
This causes VS Code to place the cursor incorrectly after applying the edit
π Expected behavior
There should be two edits: the import one on line 1
and the normal paste on line 2
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue