Skip to content

Commit

Permalink
CRAN 0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vnijs committed Oct 18, 2024
1 parent d056ee3 commit 263f1fb
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 110 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: shinyAce
Type: Package
Title: Ace Editor Bindings for Shiny
Version: 0.4.2
Date: 2022-5-5
Version: 0.4.3
Date: 2024-10-18
Authors@R: c(
person("Vincent", "Nijs", role = c("aut", "cre"), email = "radiant@rady.ucsd.edu"),
person("Forest", "Fang", role = "aut", email = "forest.fang@outlook.com"),
Expand All @@ -25,5 +25,5 @@ Suggests:
dplyr (>= 0.8.3)
BugReports: https://github.com/trestletech/shinyAce/issues
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Language: en-US
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
shinyAce 0.4.3
--------------------------------------------------------------------

* Addressed documentation issue identified by CRAN

shinyAce 0.4.2
--------------------------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions R/ace-editor.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@
#' @export
aceEditor <- function(
outputId, value, mode, theme,
vimKeyBinding = FALSE, readOnly = FALSE,
vimKeyBinding = FALSE, readOnly = FALSE,
height = "400px", fontSize = 12,
debounce = 1000, wordWrap = FALSE, showLineNumbers = TRUE,
highlightActiveLine = TRUE,
highlightActiveLine = TRUE,
selectionId = NULL, cursorId = NULL,
hotkeys = NULL, code_hotkeys = NULL,
autoComplete = c("disabled", "enabled", "live"),
Expand All @@ -123,11 +123,11 @@ aceEditor <- function(
tabSize = 4, useSoftTabs = TRUE,
showInvisibles = FALSE, setBehavioursEnabled = TRUE,
showPrintMargin = TRUE,
autoScrollEditorIntoView = FALSE,
autoScrollEditorIntoView = FALSE,
maxLines = NULL, minLines = NULL,
placeholder = NULL
) {

escapedId <- gsub("\\.", "\\\\\\\\.", outputId)
escapedId <- gsub("\\:", "\\\\\\\\:", escapedId)
payloadLst <-
Expand Down
2 changes: 1 addition & 1 deletion R/update-ace-editor.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ updateAceEditor <- function(
autoCompleters = c("snippet", "text", "keyword", "static", "rlang"),
autoCompleteList = NULL
) {

if (missing(session) || missing(editorId)) {
stop("Must provide both a session and an editorId to update Ace editor settings")
}
Expand Down
68 changes: 32 additions & 36 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,33 @@ shiny::shinyAppDir(system.file(package = "shinyAce", "examples", "12-tooltips"))
#' .completeToken
#'
#' @import utils
#'
#'
.utils <- asNamespace("utils")

#' Get namespace to get access to unexported functions, namely
#' RdTags
#'
#'
#' @import tools
#'
#'
.tools <- asNamespace("tools")



#' Retrieve an Rd object of a help query
#'
#'
#' Safely return NULL if an error is encountered.
#'
#' @inheritParams utils::help
#' @inheritDotParams utils::help
#' @param ... arguments passed to \code{utils::help}
#'
#' @return the Rd object returned from utils:::getHelpFile
#'
#' @return the Rd object returned from \code{utils:::getHelpFile}
#'
#' @import utils
#'
#'
get_help_file <- function(...) {
dots <- list(...)
if (is.character(dots$package) && nchar(dots$package) == 0)
if (is.character(dots$package) && nchar(dots$package) == 0)
dots$package <- NULL

tryCatch({
h <- do.call(help, dots)
if (length(h) > 1) h <- do.call(structure, c(h[1], attributes(h)))
Expand Down Expand Up @@ -65,16 +64,15 @@ rd_2_html <- function(...) {

#' Retrieve description section from help document
#'
#' @inheritParams get_help_file
#' @inheritDotParams get_help_file
#' @param ... arguments passed to get_help_file
#'
#' @return a character value representing the description section of a help
#' document, rendered as HTML
#'
#' @examples
#' @examples
#' shinyAce:::get_desc_help("match", package = "base")
#'
#' @import tools
#' @import tools
#'
get_desc_help <- function(...) {
x <- get_help_file(...)
Expand All @@ -86,46 +84,45 @@ get_desc_help <- function(...) {

#' Retrieve argument documentation from help document
#'
#' @inheritParams get_help_file
#' @inheritDotParams get_help_file
#' @param ... arguments passed to get_help_file
#' @param args function arguments names to get documentation for
#'
#' @return A character vector of help
#' @return A character vector of help
#'
#' @examples
#' shinyAce:::get_arg_help("match", package = "base", args = c("table", "nomatch"))
#'
#'
#' @import tools
#'
#'
get_arg_help <- function(..., args = character()) {
# TODO:
# split multi-argument help text, e.g. for function "seq" which gives a
# description for arguments "from" and "to" together

x <- get_help_file(...)
if (is.null(x)) return(character())

arg_rds <- x[[which(.tools$RdTags(x) == "\\arguments")]]
arg_rds <- Filter(function(i) attr(i, "Rd_tag") == "\\item", arg_rds)
names(arg_rds) <- Map(function(i) i[[1]][[1]], arg_rds)
arg_rds <- lapply(arg_rds, "[[", 2)

# split multiple argument entries (e.g "package, help" from ?library)
arg_rds <- Reduce(c, Map(function(name, value) {
n <- strsplit(name, ", ")[[1]]
out <- rep(list(value), length(n))
names(out) <- n
out
}, names(arg_rds), arg_rds))

# rename R "\dots" fields
names(arg_rds)[names(arg_rds) == "list()"] <- "..."

if (length(args)) arg_rds <- arg_rds[which(names(arg_rds) %in% args)]

out <- vector("character", length(args))
names(out) <- args

out[names(arg_rds)] <- vapply(arg_rds, rd_2_html, character(1L), fragment = TRUE)
out
}
Expand All @@ -134,16 +131,15 @@ get_arg_help <- function(..., args = character()) {

#' Retrieve usage section from help document
#'
#' @inheritParams get_help_file
#' @inheritDotParams get_help_file
#' @param ... arguments passed to get_help_file
#'
#' @return a character value representing the usage section of a help
#' document, rendered as HTML
#'
#' @examples
#' @examples
#' shinyAce:::get_usage_help("match", package = "base")
#'
#' @import tools
#' @import tools
#'
get_usage_help <- function(...) {
x <- get_help_file(...)
Expand All @@ -163,11 +159,11 @@ get_usage_help <- function(...) {
#'
#' @examples
#' shinyAce:::re_capture("ak09j b", "(?<num>\\d+)(?<alpha>[a-zA-Z]+)", perl = TRUE)
#'
#'
re_capture <- function(x, re, ...) {
re_match <- regexpr(re, x, ...)
out <- substring(x,
s <- attr(re_match, "capture.start"),
out <- substring(x,
s <- attr(re_match, "capture.start"),
s + attr(re_match, "capture.length") - 1)
names(out) <- attr(re_match, "capture.names")
out
Expand All @@ -186,9 +182,9 @@ meta_obj <- function() "{obj}"


#' Function for handling optional debugging messages
#'
#'
#' @inheritParams base::message
#'
#'
shinyAce_debug <- function(...) {
if (getOption("shinyAce.debug", FALSE))
message("[shinyAce] ", ...)
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
shinyAce
==========

[![Build Status](https://travis-ci.org/trestletech/shinyAce.svg?branch=master)](https://travis-ci.org/trestletech/shinyAce)

The `shinyAce` package enables Shiny application developers to use the
[Ace text editor](https://ace.c9.io/#nav=about) in their applications. All
current modes (languages) and themes are supported in this package. The
Expand Down Expand Up @@ -129,13 +127,13 @@ Known Bugs
----------

See the [Issues page](https://github.com/trestletech/shinyAce/issues) for
information on outstanding issues.
information on outstanding issues.

License
-------

The development of this project was generously sponsored by the [Institut de
Radioprotection et de Sûreté Nucléaire](https://www.irsn.fr/EN/Pages/home.aspx)
The development of this project was generously sponsored by the [Institut de
Radioprotection et de Sûreté Nucléaire](https://en.irsn.fr)
and performed by [Jeff Allen](https://trestletech.com). The code is
licensed under The MIT License (MIT).

Expand Down
2 changes: 1 addition & 1 deletion inst/examples/06-autocomplete/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ shinyServer(function(input, output, session) {
updateAceEditor(session, "plot", autoCompleters = completers)
})

output$plot <- renderPlot({
output$plot <- renderPlot({
input$eval
tryCatch({
# clear error
Expand Down
4 changes: 2 additions & 2 deletions inst/examples/06-autocomplete/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ shinyUI(fluidPage(
titlePanel("shinyAce auto completion demo"),
sidebarLayout(
sidebarPanel(
helpText("Modify the code chunks below and click Eval to see the plot update.
helpText("Modify the code chunks below and click Eval to see the plot update.
Use Ctrl+Space for code completion when enabled."),
radioButtons("dataset", "Dataset: ", c("mtcars", "airquality"), inline = TRUE),
tags$pre(" %>%"),
Expand All @@ -16,7 +16,7 @@ shinyUI(fluidPage(
div(actionButton("eval", "Eval"), class = "pull-right"), br(),
checkboxInput("enableAutocomplete", "Enable AutoComplete", TRUE),
conditionalPanel(
"input.enableAutocomplete",
"input.enableAutocomplete",
wellPanel(
checkboxInput("enableLiveCompletion", "Live auto completion", TRUE),
checkboxInput("enableNameCompletion", list("Dataset column names completion in", tags$i("mutate")), TRUE),
Expand Down
2 changes: 1 addition & 1 deletion inst/examples/07-autocomplete-combine/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ library(shinyAce)
library(dplyr)

server <- function(input, output, session) {

## Dataset Selection
dataset <- reactive({
get(input$dataset)
Expand Down
9 changes: 3 additions & 6 deletions inst/examples/12-tooltips/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ shinyServer(function(input, output, session) {
ace_completer <- aceAutocomplete("ace_editor")
ace_annotator <- aceAnnotate("ace_editor")
ace_tooltip <- aceTooltip("ace_editor")

# Enabling and Disabling Autocompletion Observer
# Enabling and Disabling Autocompletion Observer
observe({
if (input$enableAutocomplete) ace_completer$resume()
else ace_completer$suspend()
})

# Enabling and Disabling Tooltips Observer
# Enabling and Disabling Tooltips Observer
observe({
if (input$enableTooltips) ace_tooltip$resume()
else ace_tooltip$suspend()
})

# Enabling and Disabling Annotations Observer
# Enabling and Disabling Annotations Observer
observe({
if (input$enableAnnotations) ace_annotator$resume()
else ace_annotator$suspend()
Expand Down
8 changes: 4 additions & 4 deletions inst/examples/12-tooltips/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ shinyUI(fluidPage(
checkboxInput("enableTooltips", "Enable R Tooltips", TRUE),
checkboxInput("enableAnnotations", "Enable R Annotations", TRUE)),
mainPanel(
aceEditor("ace_editor",
mode = "r",
aceEditor("ace_editor",
mode = "r",
autoComplete = "live",
autoCompleters = "rlang",
autoCompleters = "rlang",
value = "# Tooltips:
# linger over an autocomplete option to view some documentation. See
# - Function descriptions
Expand All @@ -24,7 +24,7 @@ shinyUI(fluidPage(
# Annotations:
# gutter annotations used to indicate syntax errors, try uncommenting this line
# gutter annotations used to indicate syntax errors, try uncommenting this line
# with an incomplete string
# '''
Expand Down
2 changes: 1 addition & 1 deletion man/dot-tools.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/dot-utils.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions man/get_arg_help.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions man/get_desc_help.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 263f1fb

Please sign in to comment.