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

Close 1239: More devtools and usethis commands for R package development #1242

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
59 changes: 57 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,66 @@
"category": "R",
"command": "r.previewEnvironment"
},
{
"title": "Create NEWS",
"category": "R Package",
"command": "r.useNewsMd"
},
{
"title": "Initialise A Git Repository",
"category": "R Package",
"command": "r.useGit"
},
{
"title": "Connect a Local Repo with GitHub",
"category": "R Package",
"command": "r.useGitHub"
},
{
"title": "Increment Package Version",
"category": "R Package",
"command": "r.useVersion"
},
{
"title": "CRAN Submission Comments",
"category": "R Package",
"command": "r.useCranComments"
},
{
"title": "Build {pkgdown} Web Site",
"category": "R Package",
"command": "r.pkgdownBuildSite"
},
{
"title": "Load All",
"category": "R Package",
"command": "r.loadAll"
},
{
"title": "Toggle Development Mode",
"category": "R Package",
"command": "r.devMode"
},
{
"title": "Spell check",
"category": "R Package",
"command": "r.spellCheck"
},
{
"title": "CRAN Checks for Package on R-Hub",
"category": "R Package",
"command": "r.checkRhub"
},
{
"title": "CRAN Checks for Package on Win-Builder",
"category": "R Package",
"command": "r.checkWinDevel"
},
{
"title": "CRAN Release",
"category": "R Package",
"command": "r.release"
},
{
"title": "Build",
"category": "R Package",
Expand Down Expand Up @@ -1767,7 +1822,7 @@
"default": false,
"description": "Default boolean value for automatically sharing R browser ports with guests."
},
"r.plot.devArgs" :{
"r.plot.devArgs": {
"type": "object",
"markdownDescription": "The arguments for the png device to replay user graphics to show in VSCode. Requires `#r.plot.useHttpgd#` to be set to `false`. \n\nChanges the option `vsc.dev.args` in R.",
"default": {
Expand Down Expand Up @@ -1989,4 +2044,4 @@
"vsls": "^1.0.4753",
"winreg": "^1.2.4"
}
}
}
15 changes: 13 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<apiImp
'r.thead': () => rTerminal.runSelectionOrWord(['t', 'head']),
'r.names': () => rTerminal.runSelectionOrWord(['names']),
'r.runSource': () => { void rTerminal.runSource(false); },
'r.runSelection': (code?: string) => { code ? void rTerminal.runTextInTerm(code) : void rTerminal.runSelection(); },
'r.runSelection': (code?: string) => { code ? void rTerminal.runTextInTerm(code) : void rTerminal.runSelection(); },
'r.runFromLineToEnd': rTerminal.runFromLineToEnd,
'r.runFromBeginningToLine': rTerminal.runFromBeginningToLine,
'r.runSelectionRetainCursor': rTerminal.runSelectionRetainCursor,
Expand Down Expand Up @@ -109,13 +109,24 @@ export async function activate(context: vscode.ExtensionContext): Promise<apiImp

// file creation (under file submenu)
'r.rmarkdown.newFileDraft': () => rmarkdown.newDraft(),
'r.newFileDocument': () => vscode.workspace.openTextDocument({language: 'r'}).then((v) => vscode.window.showTextDocument(v)),
'r.newFileDocument': () => vscode.workspace.openTextDocument({ language: 'r' }).then((v) => vscode.window.showTextDocument(v)),

// editor independent commands
'r.createGitignore': rGitignore.createGitignore,
'r.createLintrConfig': lintrConfig.createLintrConfig,
'r.generateCCppProperties': cppProperties.generateCppProperties,
'r.loadAll': () => rTerminal.runTextInTerm('devtools::load_all()'),
'r.devMode': () => rTerminal.runTextInTerm('devtools::dev_mode()'),
'r.spellCheck': () => rTerminal.runTextInTerm('devtools::spell_check()'),
'r.checkRhub': () => rTerminal.runTextInTerm('devtools::check_rhub()'),
'r.checkWinDevel': () => rTerminal.runTextInTerm('devtools::check_win_devel()'),
'r.release': () => rTerminal.runTextInTerm('devtools::release()'),
'r.useVersion': () => rTerminal.runTextInTerm('usethis::use_version()'),
'r.useCranComments': () => rTerminal.runTextInTerm('usethis::use_cran_comments()'),
'r.useNewsMd': () => rTerminal.runTextInTerm('usethis::use_news_md()'),
'r.useGit': () => rTerminal.runTextInTerm('usethis::use_git()'),
'r.useGitHub': () => rTerminal.runTextInTerm('usethis::use_github()'),
'r.pkgdownBuildSite': () => rTerminal.runTextInTerm('pkgdown::build_site()'),

// environment independent commands. this is a workaround for using the Tasks API: https://github.com/microsoft/vscode/issues/40758
'r.build': () => vscode.commands.executeCommand('workbench.action.tasks.runTask', 'R: Build'),
Expand Down