Complete               package:svMisc               R Documentation

_G_e_t _a _c_o_m_p_l_e_t_i_o_n _l_i_s_t _f_o_r _a _R _c_o_d_e _f_r_a_g_m_e_n_t

_D_e_s_c_r_i_p_t_i_o_n:

     Returns names of objects/arguments/namespaces matching a code
     fragment.

_U_s_a_g_e:

     Complete(code, print = FALSE, types = c("default", "scintilla"),
         addition = FALSE, skip.used.args = TRUE, sep = "\n", type.sep = "?")

_A_r_g_u_m_e_n_t_s:

    code: A partial R code to be completed. 

   print: logical, print result and return invisibly. See details. 

   types: a named list giving names of types. Set to 'NA' to give only
          names. See details. 

addition: should only addition string be returned? 

skip.used.args: logical, in case if completion is within function
          arguments, should the already used named arguments be
          omitted? 

     sep: The separator to use between returned items. 

type.sep: Character string to separate types from names. 

_D_e_t_a_i_l_s:

     The completion list is context-dependent, and it is calculated as
     if the code was entered at the command line.

     If the code ends with '$' or '[[', then the function look for
     items in a list or data.frame whose name is the last identifier.

     If the code ends with '@', then the function look for slots of the
     corresponding S4 object.

     If the code ends with '::', then it looks for objects in a
     namespace.

     If the code ends with a partial identifier name, the function
     returns all visible matching keywords.

     If the code is empty or parses into an empty last token, the list
     of objects currently in the global environment is returned. Take
     care: depending on the context, this could be incorrect (but it
     should work for code entered or sourced at the command line).

     There are other situations where the completion can be calculated,
     see the help of 'rc.settings()'.

     If 'print' == 'TRUE', results are returned invisibly, and printed
     in a form: triggerPos[newline]completions separated by 'sep'.

     If 'types' are supplied, a completion will consist of name and
     type, separated by 'type.sep'. 'types' may me a vector of length
     5, giving the type codes for "function", "variable",
     "environment", "argument" and "keyword". If 'types == "default"',
     above type names are given; 'types == "scintilla"' will give
     numeric codes that can be used with "scintilla.autoCShow" function
     (SciViews-K Komodo Edit plugin).

_V_a_l_u_e:

     If 'types' == 'NA', a character vector giving the completions,
     otherwise a data frame with two columns: "completion", and "type"
     (factor with levels given by 'types' argument).
      Attributes:
      'attr(,"token")' - a completed token.
      'attr(,"triggerPos")' - number of already typed characters.
      'attr(,"fguess")' - name of guessed function.
      'attr(,"isFirstArg")' - is this a first argument?

_A_u_t_h_o_r(_s):

     Philippe Grosjean <phgrosjean@sciviews.org> & Kamil Barton

_S_e_e _A_l_s_o:

     'CompletePlus', 'CallTip'

_E_x_a_m_p_l_e_s:

         ## a data.frame
         data(iris)
             Complete("item <- iris$")
             Complete("item <- iris[[")

             ## An S4 object
         setClass("track", representation(x = "numeric", y = "numeric"))
         t1 <- new("track", x = 1:20, y = (1:20)^2)
         Complete("item2 <- t1@")

         ## A namespace
             Complete("utils::")

             ## A partial identifier
         Complete("item3 <- va")

         ## Otherwise, a list with the content of .GlobalEnv
         Complete("item4 <- ")

             ## TODO: directory ad filename completion!

