vscode-R
vscode-R copied to clipboard
Rmarkdown snippets not working with ".Rmd" extension but work with ".rmd" extension.
Hello,
Using the ".Rmd" extension will not allow me to insert Markdown snippets in the file. The Insert Snippets
command treats Markdown lines as R language and offers to insert R code snippets. Changing the file extension to ".rmd" resolves that issue and everything works as expected. I have not seen any other issues when using ".Rmd" as extension as the file seems to otherwise be properly recognized as Rmarkdown.
I am intermittently experimenting with VS Code, so I may have changed a setting in the past that causes this behavior but I could not find anything. The file.associations
for instance are empty. Any help on how to fix this is appreciated.
Thanks, Marc
VS Code 1.65.2 macOS 12.2.1 vscode-R 2.4.0
Does the file have language rmd
instead of r
?
Could you install the latest languageserver which included https://github.com/REditorSupport/languageserver/pull/511?
It is and I have the most recent languageserver version languageserver_0.3.12
.
I tested a little more and it turned out the issue was that one of the earliest code chunks had a trailing space after the three closing backticks. This affects the following scope. After fixing this things work as intended. I attached two screen shots that highlight the issue. The first shows a working situation with no trailing space, and the next two screen shots show the trailing space resulting in the following scope being interpreted as R
code. The Markdown
heading is not rendered as expected.
Thanks for getting back!



OK. I can reproduce what you have observed. Looks like the rmd syntax defined for code chunks is too strict:
https://github.com/REditorSupport/vscode-R/blob/6547330cb10a16f7bd3cdd578139cabf27f82ac0/syntax/Markdown%20Redcarpet.json#L44-L51
This issue is stale because it has been open for 365 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.