Learn R Programming

shinyAce (version 0.4.3)

aceAnnotate: Enable Error Annotations for an Ace Code Input

Description

This function dynamically evaluate R for syntax errors using the parse function.

Usage

aceAnnotate(inputId, session = shiny::getDefaultReactiveDomain())

Value

An observer reference class object that is responsible for offering code annotations. See observeEvent for more details. You can use suspend or destroy to pause to stop dynamic code completion.

The observer reference object will send a custom shiny message using

session$sendCustomMessage to the annotations endpoint containing a json list of annotation metadata objects. The json list should have a structure akin to:


  [
    {
       row:  <int: row of annotation reference>,
       col:  <int: column of annotation reference>,
       type: <str: "error", "alert" or "flash">,
       html: <str: html of annotation hover div, used by default over text>,
       text: <num: text of annotation hover div>,
    }
  ]
  

Arguments

inputId

The id of the input object

session

The session object passed to function given to shinyServer

Details

You can implement your own code completer by observing modification events to input$<editorId>_shinyAce_annotationTrigger where <editorId> is the aceEditor id. This input is only used for triggering completion and will contain a random number. However, you can access session$input[[inputId]] to get the input text for parsing.