positron
positron copied to clipboard
Auto translation of equal sign `=` to assign operator `<-`
System details:
Positron and OS details:
Positron Version: 2024.08.0 (Universal) build 5 Code - OSS Version: 1.91.0 Commit: Unknown Date: 2024-08-06T17:08:14.498Z (2 wks ago) Electron: 29.4.0 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin arm64 23.6.0
Interpreter details:
R 4.4.1
Describe the issue:
I noticed that in R scripts, whenever I copy something like x = 8 and paste it in another place in the script, the = transforms automatically to <-
I am unsure if it's a bug or if something is incorrectly specified in my settings.
Thanks
If you are using styler, this is probably just an artifact of styler getting to format your code on paste. I think it changes = to <-
You can turn this setting off if you want to otherwise keep using styler (but if you run format document it will probably also convert equals to assignment then too)
Thanks for the super quick response. Is there a way to keep the formatter but prevent it from making this translation?
@abduazizR I'm not familiar with styler but it doesn't seem like there's an option you could set unfortunately: https://stackoverflow.com/questions/50660401/use-instead-of-for-assignment-when-styling-r-code-with-styler
We're planning to implement our own formatter. We'll need a way to declare the assignment op, and also auto-detect it from the file.
Related to #4009 and #2251
With https://github.com/posit-dev/positron/pull/7199 we have removed the styler integration. Instead, we encourage users to install the Air extension, and soon (this milestone) Positron will also bundle the Air extension natively, so you won't even have to install it.
Air does not perform the = to <- auto translation (at least not right now, and if we did do it, this is probably something you could opt out of), so I consider this resolved.