Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R Markdown Enhancements (Knit Manager) #765

Merged
merged 20 commits into from
Sep 4, 2021

Conversation

ElianHugh
Copy link
Collaborator

@ElianHugh ElianHugh commented Aug 26, 2021

Enhances rendering R Markdown documents. Specifically:

  • background knitting (with progress bar)
  • set knit working directory
  • Smart knit button, use custom knit functions + rmarkdown::render_site where appropriate

Screenshots

image

image

image

"Smart" Knit Button

Custom Knit

image

image

R Markdown Site

image

image

ElianHugh and others added 5 commits August 28, 2021 01:08
Fix bug where knitDir could not be resolved when refreshing a preview
- Remove auto-generated package lock
- Remove console.log from previous debugging
@renkun-ken
Copy link
Member

Always fail to start debugging. The following error occurs on extension activation:

Activating extension 'Ikuyadeu.r' failed: rmarkdown.RMarkdownPreviewManager is not a constructor.

@ElianHugh
Copy link
Collaborator Author

Always fail to start debugging. The following error occurs on extension activation:

Activating extension 'Ikuyadeu.r' failed: rmarkdown.RMarkdownPreviewManager is not a constructor.

I suspect this is some kind of bug with TypeScript, as I had this happen until I deleted my out folder. It could also be the version of TS installed? I've updated to 4.3.5. In any case, I can't see why a wildstar import would be invalid for classes, but explicit exports would be ok

- Fixed bug where knit would error when focused on the output stream
- Get rPath every knit/preview, so that rPath can be changed without restarting session
@renkun-ken
Copy link
Member

as I had this happen until I deleted my out folder

This actually works nicely! Thanks!

src/rmarkdown/knit.ts Outdated Show resolved Hide resolved
Fallback to document folder when workspace is undefined, then fallback to NULL
src/rmarkdown/knit.ts Outdated Show resolved Hide resolved
Copy link
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely!

LGTM

@ElianHugh ElianHugh changed the title [WIP] R Markdown Enhancements (Knit Manager) R Markdown Enhancements (Knit Manager) Sep 2, 2021
@ElianHugh ElianHugh marked this pull request as ready for review September 2, 2021 05:39
@ManuelHentschel
Copy link
Member

On windows, if I set the Knit directory to the document directory, I get an error:

[VSC-R] test.Rmd process started
Erreur : '\\' inattendu(e) dans "knitr::opts_knit[['set']](root.dir = c:\\"
Ex�cution arr�t�e

[VSC-R] test.Rmd process exited with exit code 1

In the workspace root this error does not occur.

@ElianHugh
Copy link
Collaborator Author

On windows, if I set the Knit directory to the document directory, I get an error:

[VSC-R] test.Rmd process started
Erreur : '\\' inattendu(e) dans "knitr::opts_knit[['set']](root.dir = c:\\"
Ex�cution arr�t�e

[VSC-R] test.Rmd process exited with exit code 1

In the workspace root this error does not occur.

Argh, the path differences are the bane of my existence!! Thanks for catching that, hopefully the most recent commit fixes this?

package.json Outdated Show resolved Hide resolved
src/rmarkdown/knit.ts Outdated Show resolved Hide resolved
src/rmarkdown/knit.ts Outdated Show resolved Hide resolved
src/rmarkdown/knit.ts Show resolved Hide resolved
src/rmarkdown/index.ts Show resolved Hide resolved
@ManuelHentschel
Copy link
Member

Argh, the path differences are the bane of my existence!! Thanks for catching that, hopefully the most recent commit fixes this?

Can confirm that I'm not getting the error anymore

Copy link
Member

@ManuelHentschel ManuelHentschel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very experienced with Rmd, but the simple examples I tried worked nicely.

Thanks for the nice work!

- Use enum type for knitDir
- Use quickpick result, rather than onDidSelectItem
- Refresh active preview on knitDir change
- use vscode namespace
- fix default config value
@ElianHugh ElianHugh merged commit 9f03d55 into REditorSupport:master Sep 4, 2021
ElianHugh added a commit to ElianHugh/vscode-R that referenced this pull request May 12, 2022
* background knitting (with progress bar)
* set knit working directory
* Smart knit button, use custom knit functions + rmarkdown::render_site where appropriate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants