aceTooltip: Enable Completion Tooltips for an Ace Code Input

View source: R/ace-tooltips.R

aceTooltipR Documentation

Enable Completion Tooltips for an Ace Code Input

Description

This function uses the completion item object to retrieve tooltip information by parsing R help documentation and rendering to html.

Usage

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

Arguments

inputId

The id of the input object

session

The session object passed to function given to shinyServer

Details

You can implement your own tooltips by observing modification events to input$<editorId>_shinyAce_tooltipItem where <editorId> is the aceEditor id. This input contains the object passed to codeCompletion for this item. See the help for aceAutocomplete for details on the fields of the completion item object.

Value

An observer reference class object that is responsible for offering completion tooltips. See observe 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 docTooltip endpoint containing a json list of completion item metadata objects. The json list should have a structure akin to one of:

A text object

  <str: text to display for tooltip>
  

An object containing a docHTML property

  {
     docHTML: <str: html to display for tooltip div, used if available>,
  }
  

An object containing a docText property

  {
     docText: <str: text to display for tooltip div>
  }
  

trestletech/shinyAce documentation built on Oct. 19, 2024, 10:44 p.m.