REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.07k stars 128 forks source link

VS Code does not recognize REditorSupport.r as a valid default formatter #1291

Closed KatlehoJordan closed 1 year ago

KatlehoJordan commented 1 year ago

Describe the bug My VS Code .json files yield linting warnings when I set the default editor to REditorSupport.r. It indicates that the value is not accepted.

To Reproduce Steps to reproduce the behavior:

  1. Open settings.json in VS Code
  2. Add the following:
    "[r]": {
        "editor.defaultFormatter": "REditorSupport.r"
    }
  3. Observe that the linter complains with message:
    
    Defines a default formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter.

Value is not accepted. Valid values: null, "vscode.css-language-features", "vscode.html-language-features", "ms-python.isort", "vscode.json-language-features", "ms-toolsai.jupyter", "yzhang.markdown-all-in-one", "vscode.markdown-language-features", "tomoki1207.pdf", "vscode.php-language-features", "ms-python.python", "vscode.references-view", "vscode.search-result", "vscode.typescript-language-features", "KevinRose.vsc-python-indent", "ms-azuretools.vscode-docker", "narsenico.vscode-progressive-increment", "ms-python.vscode-pylance", "ElecTreeFrying.auto-import", "vscode.configuration-editing", "vscode.debug-auto-launch", "vscode.debug-server-ready", "vscode.emmet", "vscode.extension-editing", "GrapeCity.gc-excelviewer", "vscode.git", "vscode.git-base", "vscode.github", "vscode.github-authentication", "eamodio.gitlens", "vscode.grunt", "vscode.gulp", "vscode.ipynb", "vscode.jake", "ms-vscode.js-debug", "ms-vscode.js-debug-companion", "ZainChen.json", "ms-toolsai.jupyter-renderers", "vscode.markdown-math", "yzane.markdown-pdf", "shd101wyy.markdown-preview-enhanced", "vscode.media-preview", "vscode.merge-conflict", "vscode.microsoft-authentication", "vscode.npm", "ms-vscode-remote.remote-containers", "ms-vscode-remote.remote-wsl", "ms-vscode-remote.remote-wsl-recommender", "vscode.simple-browser", "SimonSiefke.svg-preview", "hediet.vscode-drawio", "ms-vscode.vscode-js-profile-table", "ms-toolsai.vscode-jupyter-cell-tags", "ms-toolsai.vscode-jupyter-slideshow", "asvetliakov.vscode-neovim", "richie5um2.vscode-sort-json".(1)


**Can you fix this issue by yourself? (We appreciate the help)**

No

**(If yes,) can we assist you with anything?**

**(If applicable) Please attach `setting.json`**

```jsonc
{
    "editor.lineNumbers": "relative",
    "files.autoSave": "afterDelay",
    "files.defaultLanguage": "${activeEditorLanguage}",
    "files.exclude": {
        "": true,
        "**/.git": false
    },
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    // Default terminal found by VS Code was not BASH
    // Default source was not the same git-bash.exe that I use
    // with the taskbar launcher, so specified manually as per
    // https://github.com/microsoft/vscode/issues/126023
    "terminal.integrated.profiles.windows": {
        "Command Prompt": {
            "args": [],
            "icon": "terminal-cmd",
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ]
        },
        "Git Bash": {
            "path": "C:\\Program Files\\Git\\git-bash.exe"
        },
        "PowerShell": {
            "icon": "terminal-powershell",
            "source": "PowerShell"
        }
    },
    "vscode-neovim.neovimExecutablePaths.win32": "C:\\Program Files\\nvim-win64\\bin\\nvim.exe",
    "workbench.list.openMode": "doubleClick",
    "editor.stickyScroll.enabled": true,
    "workbench.settings.editor": "json",
    "security.workspace.trust.untrustedFiles": "open",
    "workbench.colorTheme": "Visual Studio Dark",
    "[python]": {
        "editor.formatOnType": true
    },
    "[r]": {
        "editor.defaultFormatter": "REditorSupport.r"
    }
}

Expected behavior The linter should not complain.

Screenshots Screenshot 2023-01-17 215220

Environment (please complete the following information):

renkun-ken commented 1 year ago

Have you installed other extensions that handle r files?

KatlehoJordan commented 1 year ago

This was a user error!

I am typically running r from within VS Code Dev Containers, and therefore installing the extension into the containers only rather than system-wide.

I still had these settings in my settings.json file, rather than as customizations within my devcontainer.json files.

If I open a dev container with the extension installed, the linter does not complain, regardless of where this setting is specified (settings.json or devcontainer.son). However, if looking at settings.json when not within a Dev Container (i.e., when the extension is not installed in the active environment), then the linter complains.

Sorry to bother you! This was a case of my own misunderstanding!

Thank you for your comment and looking into this, 🙂 .