Inserting a new line when pasting
Hi
I believe my issue is similar to what has been demonstrated here https://stackoverflow.com/questions/53791340/vscode-copy-and-paste-1-line-without-newline-character-being-prepended
Briefly, when I paste a piece of code into my script, a new line is generated, which I don't want. I am not sure if setting positron to follow Rstudio customs should solve this, but in my case, it does not. Also, the suggestions on the StackOverflow question do not seem straightforward.
Could this be related to #4009, i.e. do you have editor.formatOnPaste enabled?
@abduazizR is this the behavior you are observing?
https://github.com/user-attachments/assets/d5be1edb-eee7-4909-81e0-7a0f7af2d679
Are you working in R?
Yes and yes
Could this be related to #4009, i.e. do you have
editor.formatOnPasteenabled?
I believe I am setting thisto true. I checked both the User and Default settings
I believe we have fixed this one!
https://github.com/user-attachments/assets/34376e81-a5f1-44a2-a94b-f4cde4161c75
Verified Fixed
Positron Version(s) : 2025.08.0 (Universal) build 11
OS Version : Sequoia 15.5
Test scenario(s)
| Description | Setup Code | Copied Line | Cursor Position | Expected Result |
|---|---|---|---|---|
| Paste object into empty quotes | let x = ''; |
{a: 1} |
Between single quotes | let x = '{a: 1}'; |
| Paste in middle of string | let x = 'foo bar'; |
{a: 1} |
After foo |
let x = 'foo {a: 1}bar'; |
| Paste into double quotes | let str = ""; |
{a: 1} |
Between double quotes | let str = "{a: 1}"; |
| Paste into JSON string value | const obj = {"key": ""}; |
{a: 1} |
Inside the inner quotes | const obj = {"key": "{a: 1}"}; |
| Paste numeric string | let n = ''; |
123 |
Between quotes | let n = '123'; |
| Paste into string (in Python) | x = "" |
"abc" |
Between double quotes | x = "\"abc\"" |
| Paste in multiline template string | let x = `Line 1` |
Line 2 |
After Line 1, then Enter+Paste |
let x = `Line 1\nLine 2`; |
| Paste HTML fragment into string | const html = '<div></div>'; |
<span>{a: 1}</span> |
Inside <div> |
const html = '<div><span>{a: 1}</span></div>'; |
I tested a variety of cases just to make sure it's working and that nothing was missed in this area. Please find the table above with what I've covered.