Render an Ace editor on an application page.
aceEditor(
outputId,
value,
mode,
theme,
vimKeyBinding = FALSE,
readOnly = FALSE,
height = "400px",
fontSize = 12,
debounce = 1000,
wordWrap = FALSE,
showLineNumbers = TRUE,
highlightActiveLine = TRUE,
selectionId = NULL,
cursorId = NULL,
hotkeys = NULL,
code_hotkeys = NULL,
autoComplete = c("disabled", "enabled", "live"),
autoCompleters = c("snippet", "text", "keyword"),
autoCompleteList = NULL,
tabSize = 4,
useSoftTabs = TRUE,
showInvisibles = FALSE,
setBehavioursEnabled = TRUE,
showPrintMargin = TRUE,
autoScrollEditorIntoView = FALSE,
maxLines = NULL,
minLines = NULL,
placeholder = NULL
)
The ID associated with this element
The initial text to be contained in the editor.
The Ace mode
to be used by the editor. The mode
in Ace is often the programming or markup language that you're using and
determines things like syntax highlighting and code folding. Use the
getAceModes
function to enumerate all the modes available.
The Ace theme
to be used by the editor. The theme
in Ace determines the styling and coloring of the editor. Use
getAceThemes
to enumerate all the themes available.
If set to TRUE
, Ace will enable vim-keybindings.
Default value is FALSE
.
If set to TRUE
, Ace will disable client-side editing.
If FALSE
(the default), it will enable editing.
A number (which will be interpreted as a number of pixels) or
any valid CSS dimension (such as "50%
", "200px
", or
"auto
").
Defines the font size (in px) used in the editor and should be an integer. The default is 12.
The number of milliseconds to debounce the input. This will cause the client to withhold update notifications until the user has stopped typing for this amount of time. If 0, the server will be notified of every keystroke as it happens.
If set to TRUE
, Ace will enable word wrapping.
Default value is FALSE
.
If set to TRUE
, Ace will show line numbers.
If set to TRUE
, Ace will highlight the active
line.
The ID associated with a change of selected text
The ID associated with a cursor change.
A list whose names are ID names and whose elements are the shortcuts of keys. Shortcuts can either be a simple string or a list with elements 'win' and 'mac' that that specifies different shortcuts for win and mac (see example 05).
A nested list. The first element indicates the code type (e.g., "r")
The second element is a list whose names are ID names and whose elements are the
shortcuts of keys (see hotkeys
)
Enable/Disable auto code completion. Must be one of the following:
"disabled"
Disable Code Autocomplete
"enabled"
Enable Basic Code Autocomplete. Autocomplete can be triggered using Ctrl-Space, Ctrl-Shift-Space, or Alt-Space.
"live"
Enable Live Code Autocomplete. In addition to Basic Autocomplete, it will automatically trigger at each key stroke.
By default, only local completer is used where all aforementioned code pieces
will be considered as candidates. Use autoCompleteList
for static
completions and aceAutocomplete
for dynamic R code completions.
Character vector of completers to enable. If set to NULL
,
all completers will be disabled. Select one or more of "snippet", "text", "static",
"keyword", and "rlang" to control which completers to use. Default option is to
use the "snippet", "text", and "keyword" autocompleters
A named list that contains static code completions
candidates. This can be especially useful for Non-Standard Evaluation (NSE)
functions such as those in dplyr
and ggvis
. Each element in list
should be a character array whose words will be listed under the element key.
For example, to suggests column names from mtcars
and airquality
,
you can use list(mtcars = colnames(mtcars), airquality = colnames(airquality))
.
Set tab size. Default value is 4
Replace tabs by spaces. Default value is TRUE
Show invisible characters (e.g., spaces, tabs, newline characters). Default value is FALSE
Determines if the auto-pairing of special characters, like quotation marks, parenthesis, or brackets should be enabled. Default value is TRUE.
Show print margin. Default value is True
If TRUE, expands the size of the editor window as new lines are added
Maximum number of lines the editor window will expand to when autoScrollEditorIntoView is TRUE
Minimum number of lines in the editor window when autoScrollEditorIntoView is TRUE
A string to use a placeholder when the editor has no content
if (FALSE) {
aceEditor(
outputId = "myEditor",
value = "Initial text for editor here",
mode = "r",
theme = "ambiance"
)
aceEditor(
outputId = "myCodeEditor",
value = "# Enter code",
mode = "r",
hotkeys = list(
helpKey = "F1",
runKey = list(
win = "Ctrl-R|Ctrl-Shift-Enter",
mac = "CMD-ENTER|CMD-SHIFT-ENTER"
)
),
wordWrap = TRUE, debounce = 10
)
aceEditor(
outputId = "mySmartEditor",
value = "plot(wt ~ mpg, data = mtcars)",
mode = "r",
autoComplete = "live",
autoCompleteList = list(mtcars = colnames(mtcars))
)
}