Add R Markdown surround and frontmatter comments#269
Add R Markdown surround and frontmatter comments#269andycraig merged 4 commits intoREditorSupport:masterfrom
Conversation
The new lines in package.json are copied from https://github.com/microsoft/vscode/blob/master/extensions/markdown-basics/package.json which is MIT-licensed. The license information is included in ThirdPartyNotices.txt. License information cannot be added to package.json because JSON does not allow comments.
|
I test this on macOS. Commenting Commenting works nicely in
but does not work with python code chunks (treating it like markdown content)
Although this is not covered by this PR but it still seems worthy pointing out as RStudio supports many language chunks in Rmd. Surround in R Markdown The surrounding of quotes works well. Backticks in R Markdown/R document files The backticks works well but introduces an obvious drawback: Typing backticks to create a code chunk will never end up with three backticks but two or four. Extra things to notice It looks the languageserver diagnostics will fail with Rmd that contains markdown code chunk of any language (```anything). Will raise an issue at lintr or languageserver. |
|
@andycraig Thank you for your pull request. |
|
@Ikuyadeu Great, thank you! @renkun-ken Thank you for testing!
I'll open a new issue for Rmd code chunks like ```{python}`. For me on Windows 10, Python markdown code chunks like ```python do work. That is, if I create a block and use the
Whoops, I missed that! I will add a commit to remove backticks from auto-closing pairs in R Markdown. Thank you! |
|
@andycraig Sorry, my mistake, ```python works as expected, both highlighing and commenting. The backtick not auto-closing looks good now. Everything LGTM. If you have nothing more to add, please feel free to merge. |
|
@renkun-ken Thank you for the checks! I'll go ahead and merge now. |
Fixes #249
Fixes #260
This PR includes third-party code. The new lines in package.json are copied from
https://github.com/microsoft/vscode/blob/master/extensions/markdown-basics/package.json
which is MIT-licensed. The license information is included in
ThirdPartyNotices.txt. License information cannot be added topackage.jsonbecause JSON does not allow comments. I also added these lines in 1f355a3, and then removed them in 4a108e1. I didn't include the license information that time but I think I should have. I copied the format ofThirdPartyNotices.txtfrom https://github.com/microsoft/vscode/blob/master/ThirdPartyNotices.txt@Ikuyadeu I have put your name in
ThirdPartyNotices.txt- please check that it is okay.What problem did you solve?
Adds surround support for R Markdown files.
Adds backtick surround and completion for R Markdown and R documentation files.
Adds correct comments for R Markdown YAML frontmatter, and other languages already supported by VSCode markdown.
How can I check this pull request?
Comments in R Markdown YAML frontmatter: Place cursor in YAML frontmatter. Use command
Toggle Line Comment. Previously: Comment is HTML comment<!-- -->. Now: Comment is YAML comment#.Surround in R Markdown: In R Markdown file, select a word. Press
'. Previously: Word is replaced by'. Now: Word is surrounded by'.Backticks in R Markdown/R document files: Select a word. Press backtick. Previously: Word is replaced by backtick. Now: Word is surrounded by backticks.