change file association in vscode if code chunk not detected

  • For first time setup for VS Code to run R Markdown, change the files association to enable it to run rmd file in code block chunks (like in R Studio)

    • Sometimes you may also need to do this after certain VS Code update. Possibly due to some settings being reset
    • Steps
      • (Command Palette > Preferences: Open User Settings (JSON))
      • Text Editor > Files
      • change "*.rmd": "markdown" to "*.rmd": "rmd"
  • If you’re aim to make VS Code behave quite similar to R Studio, you may interested to enable better R plotting in VSCodeenable better R plotting in VSCode


    Enable R > Plot: Use httpgd is VS Code settings to have better support for R plots (especially multiple plot in single command)

    Default VSCode plot for R is simplistic and...

[!quote]- Stack Overflow post on how to fix I hope you resolved this by now, but just in case - I too had been happily using *.Rmd with VS Code, but not for a while, and the chunks were no longer recognised as R - or chunks.

I had been using r-lsp, which once flagged as deprecated, so I just got rid of it, in a gung-ho cull…

Now moving to vscode-R, I found I had to change the files.associations in VSCode's settings.json (Ctrl+Shift+P > Preferences: Open User Settings (JSON)) from the previous value:

  "files.associations": {
    "*.rmd": "markdown"
  },

to

  "files.associations": {
    "*.Rmd": "rmd"
  }

Maybe it was always wrong! Details in the vscode-R wiki, here, https://github.com/REditorSupport/vscode-R/wiki/R-Markdown.

References

Metadata

  • topic:: 00 Coding00 Coding
    #MOC / for programming language, coding guide and libraries focusing on data analytics and html/css
    • related:: 01 R programming01 R programming
      #MOC / for notes sub to 00 Coding with focus on how I use Jekyll
  • created:: 2022-09-05 Private or Broken Links
    The page you're looking for is either not available or private!
  • updated:: 2023-01-15 Private or Broken Links
    The page you're looking for is either not available or private!
  • #Reference