rc.settings(ops, ns, args, func, ipck, S3, data, help,
argdb, fuzzy, quotes, files)rc.status()
rc.getOption(name)
rc.options(...)
.DollarNames(x, pattern)
## S3 method for class 'default':
.DollarNames(x, pattern = "")
## S3 method for class 'list':
.DollarNames(x, pattern = "")
## S3 method for class 'environment':
.DollarNames(x, pattern = "")
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
All settings are turned on by default except ipck
,
func
, and fuzzy
. Turn more off if your CPU cycles are
valuable; you will still retain basic completion on names of objects
in the search list. See below for additional details.
options
."$"
are computed and returned.rc.settings
is called without any arguments, it returns the
current settings as a named logical vector. Otherwise, it returns
NULL
invisibly.
rc.status
returns, as a list, the contents of an internal
(unexported) environment that is used to record the results of the
last completion attempt. This can be useful for debugging. For such
use, one must resist the temptation to use completion when typing the
call to rc.status
itself, as that then becomes the last attempt
by the time the call is executed.The items of primary interest in the returned list are:
.completeToken
, as a character vector..assignToken
(possibly inside a call
to .guessTokenFromLine
)..assignLinebuffer
..assignStart
..assignEnd
.settings
and options
give
the current values of settings and options respectively. rc.getOption
and rc.options
behave much like
getOption
and options
respectively.
.assignToken(text) .assignLinebuffer(line) .assignStart(start) .assignEnd(end)
.completeToken() .retrieveCompletions() .getFileComp()
.guessTokenFromLine() .win32consoleCompletion(linebuffer, cursorPosition, check.repeat = TRUE, minlength = -1)
.addFunctionInfo(...)
The first four functions set up a completion attempt by specifying the
token to be completed (text
), and indicating where
(start
and end
, which should be integers) the token is
placed within the complete line typed so far (line
).
Potential completions of the token are generated by
.completeToken
, and the completions can be retrieved as an Rcharacter vector using .retrieveCompletions
. It is possible for
the user to specify a replacement for this function by setting
rc.options("custom.completer")
; if not NULL
, this
function is called to compute potential completions. This facility is
meant to help in situations where completing as R code is not
appropriate. See source code for more details.
If the cursor is inside quotes, completion may be suppressed. The
function .getFileComp
can be used after a call to
.completeToken
to determine if this is the case (returns
TRUE
), and alternative completions generated as deemed useful.
In most cases, filename completion is a reasonable fallback.
The .guessTokenFromLine
function is provided for use with
backends that do not already break a line into tokens. It requires
the linebuffer and endpoint (cursor position) to be already set, and
itself sets the token and the start position. It returns the token as
a character string.
The .win32consoleCompletion
is similar in spirit, but is more
geared towards the Windows GUI (or rather, any front-end that has no
completion facilities of its own). It requires the linebuffer
and cursor position as arguments, and returns a list with three
components, addition
, possible
and comps
. If
there is an unambiguous extension at the current position,
addition
contains the additional text that should be inserted
at the cursor. If there is more than one possibility, these are
available either as a character vector of preformatted strings in
possible
, or as a single string in comps
.
possible
consists of lines formatted using the current
width
option, so that printing them on the console one line at
a time will be a reasonable way to list them. comps
is a space
separated (collapsed) list of the same completions, in case the
front-end wishes to display it in some other fashion.
The minlength
argument can be used to suppress completion when
the token is too short (which can be useful if the front-end is set up
to try completion on every keypress). If check.repeat
is
TRUE
, it is detected if the same completion is being requested
more than once in a row, and ambiguous completions are returned only
in that case. This is an attempt to emulate GNU Readline behaviour,
where a single TAB completes up to any unambiguous part, and multiple
possibilities are reported only on two consecutive TABs.
As the various front-end interfaces evolve, the details of these functions are likely to change as well.
The function .addFunctionInfo
can be used to add information
about the permitted argument names for specific functions. Multiple
named arguments are allowed in calls to it, where the tags are names
of functions and values are character vectors representing valid
arguments. When the argdb
setting is TRUE
, these are
used as a source of valid argument names for the relevant functions.
rc.settings
. The most basic level, which can not be
turned off once the completion functionality is activated, provides
completion on names visible on the search path, along with a few
special keywords (e.g., TRUE
). This type of completion is not
attempted if the partial [object Object],[object Object],[object Object],[object Object],[object Object]