Vscode-r: Line Comment in Rmarkdown

Created on 5 Feb 2020  路  5Comments  路  Source: Ikuyadeu/vscode-R

In an Rmd file, outside of code chunks, using the 'Toggle Line Comment' command should add an HTML comment, not a #

Commenting out TEXT should result in

<!-- TEXT -->

and not

# TEXT
bug

Most helpful comment

I am reworking the Rmd syntax so that we use VSCode's built-in Markdown grammar, and add to it code chunks with braces and inline R code. This should also fix #36, #48 and #116.

All 5 comments

@awellis Thank you for your suggestion. I agree, this would be the preferred behaviour.

I think VSCode would do this for us automatically if we handled Rmd as Markdown with R as an embedded language.

Without vscode-R installed, VSCode provides highlighting for R code blocks without braces around the r:

highlighting

Outside of code chunks, comments are HTML comments as expected. Inside code chunks without braces, comments are R/Python comments as expected.

I think the current vscode-R Rmd grammar is providing highlighting for code chunks with braces, but blocking 'built-in' VSCode features like HTML comments outside of code chunks.

As a side note, here are the languages that VSCode provides highlighting for without any extensions installed: https://github.com/Microsoft/vscode/tree/master/extensions

I am reworking the Rmd syntax so that we use VSCode's built-in Markdown grammar, and add to it code chunks with braces and inline R code. This should also fix #36, #48 and #116.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renkun-ken picture renkun-ken  路  3Comments

Nightwingg picture Nightwingg  路  6Comments

Victsz picture Victsz  路  5Comments

JimmyZJX picture JimmyZJX  路  3Comments

MaTo04 picture MaTo04  路  5Comments