Skip to content

Commit

Permalink
feat: add .radian_profile to make vscode users' life easier
Browse files Browse the repository at this point in the history
  • Loading branch information
edalfon committed Apr 18, 2024
1 parent 42bdaab commit deb775e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .radian_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# to try and deal with the weird parenthesis added
# https://github.com/REditorSupport/vscode-R/issues/419
options(radian.auto_match = FALSE)

# to get rid of empty rows below the command lie
# https://github.com/randy3k/radian/issues/135
options(radian.complete_while_typing = FALSE)

20 changes: 10 additions & 10 deletions R/targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#' @export
#' @md
targetsme <- function(install_deps = TRUE) {

usethis::proj_set(".", force = TRUE)

use_targets_templates()
Expand All @@ -31,7 +30,6 @@ use_targets <- targetsme
#' @export
#' @md
use_targets_templates <- function() {

# targets file ####
usethis::use_template(
template = "targets/_targets.R", save_as = "_targets.R",
Expand All @@ -43,7 +41,11 @@ use_targets_templates <- function() {
)
usethis::use_template(
template = "targets/tar_visnetwork.yml", save_as = "tar_visnetwork.yml",
ignore = TRUE, open = TRUE, package = "flowme"
ignore = TRUE, open = FALSE, package = "flowme"
)
usethis::use_template(
template = "targets/_radian_profile", save_as = ".radian_profile",
ignore = TRUE, open = FALSE, package = "flowme"
)

# R files ####
Expand Down Expand Up @@ -91,7 +93,6 @@ use_targets_templates <- function() {
#' @export
#' @md
use_targets_gitignore <- function() {

usethis::use_git_ignore("_targets")
usethis::use_git_ignore("*.html", "report")
usethis::use_git_ignore("*.docx", "report")
Expand All @@ -107,7 +108,6 @@ use_targets_gitignore <- function() {
#' @export
#' @md
use_targets_description <- function(install_deps = TRUE) {

usethis::use_description(check_name = FALSE)
desc::desc_set_dep("targets")
desc::desc_set_dep("tarchetypes")
Expand All @@ -125,14 +125,15 @@ use_targets_description <- function(install_deps = TRUE) {
#'
#' @export
#' @md
tar_make_job <- function () {

tar_make_job <- function() {
rstudioapi::documentSaveAll()

if (file.exists("pre_tar_make.R")) source("pre_tar_make.R")

job::job(
{targets::tar_make()},
{
targets::tar_make()
},
import = NULL,
packages = NULL,
title = "{targets} pipeline"
Expand All @@ -143,7 +144,7 @@ tar_make_job <- function () {
#'
#' @export
#' @md
tar_visnetwork_custom <- function () {
tar_visnetwork_custom <- function() {
rstudioapi::documentSaveAll()

if (file.exists("tar_visnetwork.yml")) {
Expand All @@ -166,4 +167,3 @@ tar_visnetwork_custom <- function () {

custom_visnetwork
}

8 changes: 8 additions & 0 deletions inst/templates/targets/_radian_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# to try and deal with the weird parenthesis added
# https://github.com/REditorSupport/vscode-R/issues/419
options(radian.auto_match = FALSE)

# to get rid of empty rows below the command lie
# https://github.com/randy3k/radian/issues/135
options(radian.complete_while_typing = FALSE)

0 comments on commit deb775e

Please sign in to comment.