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

Setting indentation for formatting .r files in settings.json does not take effect. #6017

Open
dbcoffee opened this issue Jan 16, 2025 · 2 comments
Labels
area: formatting Issues related to formatting and indentation info needed Waiting on information

Comments

@dbcoffee
Copy link

System details: Windows 11

Positron and OS details:

Positron Version: 2025.01.0 (system setup) build 159
Code - OSS Version: 1.95.0
Commit: bc8820b
Date: 2025-01-09T23:34:24.616Z
32.2.1
128.0.6613.186
Electron: 20.18.0
ElectronBuildId: 12.8.374.38-electron.0
Chromium: Windows_NT x64 10.0.26100
Node.js: undefined
V8: undefined
OS: undefined

Interpreter details:

R 4.4.1

Describe the issue:

In Positron, my settings are as follows:

"editor.tabSize": 4,
"editor.insertSpaces": true,

When formatting the document, the code indents with two spaces. I also tried adding the following settings:

"[r]": {
    "editor.tabSize": 4,
    "editor.insertSpaces": true
}

However, after formatting the R document, the indentation remains at two characters. Is this a bug, or is there something wrong with my settings?

Steps to reproduce the issue:

When format R script.

@sharon-wang
Copy link
Member

Hi @dbcoffee! Which settings file are you updating? Could you include a screenshot of the entire file?

I was able to change the settings by doing the following:

  1. Open up the Command Prompt (Ctrl + Shift + P or Cmd + Shift + P)
  2. Search for Preferences: Open User Settings (JSON)
  3. Add the following to the settings.json file that opens
        "[r]": {
            "editor.tabSize": 4,
            "editor.insertSpaces": true
        }
  4. Save the settings.json file -- example of the entire file:
    Image

@sharon-wang sharon-wang added area: formatting Issues related to formatting and indentation info needed Waiting on information labels Jan 16, 2025
@dbcoffee
Copy link
Author

I have modified the user settings.json file. My settings JSON is as follows:

{
    "workbench.colorTheme": "GitHub Light Colorblind (Beta)",
    "editor.hover.delay": 0,
    "editor.hover.hidingDelay": 0,
    "window.openFilesInNewWindow": "on",
    "explorer.confirmDelete": false,
    "editor.formatOnPaste": true,
    "outline.showVariables": false,
    "outline.icons": false,
    "notebook.breadcrumbs.showCodeCells": false,
    "quarto.visualEditor.lineNumbers": true,
    "quarto.visualEditor.spelling": false,
    "notebook.outline.showCodeCellSymbols": false,
    "quarto.usePipQuarto": false,
    "Lingma.cloudModelAutoTriggerGenerateLength": "long",
    "Lingma.cloudModelManualTriggerGenerateLength": "long",
    "Lingma.cloudModelLanguagesOrFileExtensions": "",
    "outline.showFunctions": true,
    "outline.showMethods": false,
    "editor.rulers": [],
    "editor.guides.highlightActiveBracketPair": false,
    "editor.renderLineHighlight": "none",
    "editor.guides.indentation": false,
    "editor.occurrencesHighlight": "off",
    "positron.viewer.interactivePlotsInViewer": true,
    "application.experimental.positronPlotsInEditorTab": true,
    "positron.RemoteHostExperimental": true,
    "editor.formatOnType": true,
    "rstudio.keymap.enable": true,
    "positron.r.kernel.logLevel": "trace",
    "application.experimental.postitronPlotsInEditorTab": true,
    "[r]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": true
    }
}

Despite these settings, when formatting R code (.r files), it still maintains a 2-space indentation instead of following the set 4-space indentation."

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 info needed Waiting on information
Projects
None yet
Development

No branches or pull requests

2 participants