Title: Newlines removed/incorrect code generated for `getPasteEdits` · Issue #58784 · microsoft/TypeScript · GitHub
Open Graph Title: Newlines removed/incorrect code generated for `getPasteEdits` · Issue #58784 · microsoft/TypeScript
X Title: Newlines removed/incorrect code generated for `getPasteEdits` · Issue #58784 · microsoft/TypeScript
Description: Imagine the following file: // comment function f() {} When I press Ctrl+x on the line containing f, and paste it again, what VS Code does is it creates a buffer with the following contents: // comment and then sends **this request for p...
Open Graph Description: Imagine the following file: // comment function f() {} When I press Ctrl+x on the line containing f, and paste it again, what VS Code does is it creates a buffer with the following contents: // com...
X Description: Imagine the following file: // comment function f() {} When I press Ctrl+x on the line containing f, and paste it again, what VS Code does is it creates a buffer with the following contents: // com...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/58784
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Newlines removed/incorrect code generated for `getPasteEdits`","articleBody":"Imagine the following file:\r\n\r\n```ts\r\n// comment\r\n\r\nfunction f() {}\r\n```\r\n\r\nWhen I press \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ex\u003c/kbd\u003e on the line containing `f`, and paste it again, what VS Code does is it creates a buffer with the following contents:\r\n\r\n```ts\r\n// comment\r\n\r\n```\r\n\r\n\u003cdetails\u003e\u003csummary\u003eand then sends **this request for paste edits**\u003c/summary\u003e\r\n\r\n```json\r\n {\r\n \"file\": \"d:\\\\scratch\\\\copypasta\\\\src\\\\file.ts\",\r\n \"pastedText\": [\r\n \"function f() {}\\r\\n\"\r\n ],\r\n \"pasteLocations\": [\r\n {\r\n \"start\": {\r\n \"line\": 2,\r\n \"offset\": 1\r\n },\r\n \"end\": {\r\n \"line\": 2,\r\n \"offset\": 1\r\n }\r\n }\r\n ],\r\n \"copiedFrom\": {\r\n \"file\": \"d:\\\\scratch\\\\copypasta\\\\src\\\\file.ts\",\r\n \"spans\": [\r\n {\r\n \"start\": {\r\n \"line\": 3,\r\n \"offset\": 1\r\n },\r\n \"end\": {\r\n \"line\": 3,\r\n \"offset\": 16\r\n }\r\n }\r\n ]\r\n }\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\u003csummary\u003eand receives **this response**.\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n \"edits\": [\r\n {\r\n \"fileName\": \"d:/scratch/copypasta/src/file.ts\",\r\n \"textChanges\": [\r\n {\r\n \"start\": {\r\n \"line\": 1,\r\n \"offset\": 15\r\n },\r\n \"end\": {\r\n \"line\": 1,\r\n \"offset\": 15\r\n },\r\n \"newText\": \"function f() {}\\r\\n\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"fixId\": \"providePostPasteEdits\"\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\r\nAfter the paste, the file no longer contains the original contents, and instead contains invalid text.\r\n\r\n```ts\r\n// commentfunction f() {}\r\n\r\n\r\n```\r\n","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2024-06-06T07:46:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/58784/TypeScript/issues/58784"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:265ddf25-3e6c-ee70-02b3-cd151db1952a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CEB2:125470:30AFB1:44E523:6A623567 |
| html-safe-nonce | 4b2cb4ab057f234bd05ec3b26aaf21e9c7529435b35dfa7dbd023953ccec3a69 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRUIyOjEyNTQ3MDozMEFGQjE6NDRFNTIzOjZBNjIzNTY3IiwidmlzaXRvcl9pZCI6IjM2NTgxMTczNTk2Nzk0NTI1MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3f491522f8eb2958b6a011e24ca1b70bb7c33e435ab192b824658c357b9994aa |
| hovercard-subject-tag | issue:2337574555 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/58784/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a917478d488ed2bf814c56e5ca457a4aa0b98ac5ffd07f5ad52ed1c770550a0c/microsoft/TypeScript/issues/58784 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a917478d488ed2bf814c56e5ca457a4aa0b98ac5ffd07f5ad52ed1c770550a0c/microsoft/TypeScript/issues/58784 |
| og:image:alt | Imagine the following file: // comment function f() {} When I press Ctrl+x on the line containing f, and paste it again, what VS Code does is it creates a buffer with the following contents: // com... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielRosenwasser |
| hostname | github.com |
| expected-hostname | github.com |
| None | f01037538d0c99e88fa8e01da1b1825ad354ff4da745198c7392a43592c8398c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10b5a8861bf21b66a650f894089f8ce1476c1d49 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width