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

Every new line in an R script automatically indents by one space #5258

Closed
jack-davison opened this issue Nov 4, 2024 · 14 comments
Closed

Every new line in an R script automatically indents by one space #5258

jack-davison opened this issue Nov 4, 2024 · 14 comments
Assignees
Labels
bug Something isn't working lang: r support

Comments

@jack-davison
Copy link

System details:

Positron and OS details:

Positron Version: 2024.11.0 (user setup) build 140
Code - OSS Version: 1.93.0
Commit: e0d844b
Date: 2024-10-31T14:22:13.808Z
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Interpreter details:

R 4.4.3

Describe the issue:

Whenever I go to a new line in a .R file a space is automatically added.

I have tried to disable and re-enable extensions, but it's still happening.

Steps to reproduce the issue:

  1. Open R Script
  2. Add new line
  3. Note the addition of the indents.

Image

Expected or desired behavior:

I would imagine there would not be any indentation.

Were there any error messages in the UI, Output panel, or Developer Tools console?

N/A

@testlabauto
Copy link
Contributor

testlabauto commented Nov 4, 2024

Hi, thank you for using Positron! Unfortunately, we are not able to reproduce this issue locally so we are hoping you can provide some more diagnostic information.

Is it correct to assume that you tried to repro with all user installed extensions disabled (and it still repros)?

Could you perhaps capture your settings.json as a file and share it? Here is an image showing where the button is to go from the visual editor to the file view:

Image

If you want to try it, you can also cut out all your settings, save the json elsewhere, and retest with all default settings. Then you would be able to paste back in your settings from the saved location after the test.

@testlabauto testlabauto added info needed Waiting on information lang: r labels Nov 4, 2024
@jack-davison
Copy link
Author

Hi Christopher,

Thanks for getting back.

Is it correct to assume that you tried to repro with all user installed extensions disabled (and it still repros)?

Yes, that's right.

Could you perhaps capture your settings.json as a file and share it? Here is an image showing where the button is to go from the visual editor to the file view:

My settings seem quite lightweight:

{
    "rstudio.keymap.enable": true,
    "git.confirmSync": false,
    "python.defaultInterpreterPath": "C:\\Users\\JD38\\AppData\\Local\\Programs\\Python\\Python312\\python.exe"
}

I've deleted these and the situation persists:

Image

@jack-davison
Copy link
Author

I'll also note a fresh install doesn't fix it.

If I'm quick, when Positron first loads it doesn't have this issue, but after a second or so it kicks in, which makes me think its an extension problem.

@sharon-wang
Copy link
Member

@jack-davison if you disable the extensions, then click one of the Restart Extensions buttons, wait for the reload and try again, are you still seeing the issue?

Image

The Extensions Host needs to be restarted for the extension disable to take. If the issue still persists after disabling and reloading extensions, then something else could be the culprit.

If the issue is gone after disabling and reloading extensions, we could try a bit of a tedious task of disabling individual extensions and checking which one is resulting in this issue. Additionally, if you're willing to share the output of running positron --list-extensions in a Terminal, that could help us discern which extensions to take a closer look at.

@lionel-
Copy link
Contributor

lionel- commented Nov 7, 2024

If I'm quick, when Positron first loads it doesn't have this issue, but after a second or so it kicks in, which makes me think its an extension problem.

Could you please shut down the R session that automatically starts and see if the issue persists?

Image

The problem might come from the LSP running in the R session.

@strengejacke
Copy link

I also see this issue, but it I couldn't figure out a systematic reason - sometimes, it happens, sometimes not, is my impression.

insert_space.mp4

Setup:

Positron Version: 2024.11.0 (system setup) build 140
Code - OSS Version: 1.93.0
Commit: e0d844b031f95acbf89f234a2cce2af9b6721f6c
Date: 2024-10-31T14:14:22.699Z
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Here's my setup:
https://gist.github.com/strengejacke/2a785f8e096d94bc84fb6b877aad4fb1

@lpembleton
Copy link

Same issue here on a fresh install with no extra extensions installed. Issue also persists even after running 'Reload With Extensions Disabled' from the command palette.

@juliasilge
Copy link
Contributor

juliasilge commented Nov 12, 2024

It's definitely tough to debug something like this that we ourselves can't reproduce! For a first step, can you all try turning off the R session. You can do this by clicking this button:

Image

After that, your R session will be shut down (do not restart it!):

Image

With no R running, do you still see the behavior with the additional space being added? Do you see this behavior in a .qmd or .Rmd file, or only .R?

@jack-davison
Copy link
Author

Hi @juliasilge,

When I disable the R session via the console, the error stops and the indents do not occur. When I turn it back on, the issue reoccurs.

The issue doesn't happen in .qmd files regardless of whether the R console is active or stopped.

Cheers,
Jack

@lpembleton
Copy link

Yes same here, error goes away if R is not running, and does not occur in .qmd .Rmd or any python related files regardless of whether R is running or not.

Thanks for looking into this, I understand its difficult when you cannot replicate it on your end.

Cheers,
Luke

@lionel-
Copy link
Contributor

lionel- commented Nov 13, 2024

Could y'all please open a new positron session, trigger the wrong indents a few times, and give us your R logs? You can find them by following the steps in https://positron.posit.co/troubleshooting.html#python-and-r-logs. I'm especially interested in the logs for the language server but also the runtime.

@DavisVaughan
Copy link
Contributor

I managed to reproduce on a windows vm based on these comments. It's a tree-sitter-r issue, tracking here r-lib/tree-sitter-r#151, thanks all!

@juliasilge juliasilge added bug Something isn't working support and removed info needed Waiting on information labels Nov 13, 2024
@juliasilge juliasilge added this to the 2024.12.0 Pre-Release milestone Nov 13, 2024
DavisVaughan added a commit that referenced this issue Nov 14, 2024
### Positron Release Notes

#### New Features

- N/A

#### Bug Fixes

- On Windows, indents of size 1 are no longer randomly added in R
scripts (#5258).
@testlabauto
Copy link
Contributor

Hello @jack-davison, would you mind trying out the new release
2024.12.0-41
and see if it is now working for you?

@jack-davison
Copy link
Author

Hi @testlabauto - seems to be working now!

Thanks for everyone's help here!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working lang: r support
Projects
None yet
Development

No branches or pull requests

8 participants