Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto translation of equal sign = to assign operator <- #4435

Open
abduazizR opened this issue Aug 21, 2024 · 4 comments
Open

Auto translation of equal sign = to assign operator <- #4435

abduazizR opened this issue Aug 21, 2024 · 4 comments
Labels
area: formatting Issues related to formatting and indentation enhancement New feature or request lang: r support

Comments

@abduazizR
Copy link

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 <-

image
image
image
image

I am unsure if it's a bug or if something is incorrectly specified in my settings.

Thanks

@DavisVaughan
Copy link
Contributor

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)

Screenshot 2024-08-21 at 5 03 06 PM

@abduazizR
Copy link
Author

Thanks for the super quick response. Is there a way to keep the formatter but prevent it from making this translation?

@lionel- lionel- added lang: r area: formatting Issues related to formatting and indentation labels Aug 22, 2024
@lionel-
Copy link
Contributor

lionel- commented Aug 22, 2024

@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.

@lionel- lionel- added the enhancement New feature or request label Aug 22, 2024
@juliasilge
Copy link
Contributor

Related to #4009 and #2251

@juliasilge juliasilge added this to the Release Candidate milestone Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: formatting Issues related to formatting and indentation enhancement New feature or request lang: r support
Projects
None yet
Development

No branches or pull requests

4 participants