Hi, Would it be possible to add the capability for functions to register how they would like to complete themselves. Currently, there is the .addFunctionInfo, but it allows only functions to register a static list of potential completions, I was thinking of a way to register not a fixed list of possible completions, but a __function__ that would calculate completions dynamically. This could be useful for the "new" function in R, if associated with something that can retrieve the current list of S4 classes (not sure this exists). Another example of where this could be used would be the .jnew function from rJava, where the first argument is a java class, associated with something that can complete java class names. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/w33B : Completion for java objects |- http://tr.im/vzip : Code Snippet : List of CRAN packages `- http://tr.im/vsK1 : R parser package on CRAN
On 8/21/09, Romain Francois <romain.francois at dbmail.com> wrote:> Hi, > > Would it be possible to add the capability for functions to register how > they would like to complete themselves. > > Currently, there is the .addFunctionInfo, but it allows only functions to > register a static list of potential completions, I was thinking of a way to > register not a fixed list of possible completions, but a __function__ that > would calculate completions dynamically. > > This could be useful for the "new" function in R, if associated with > something that can retrieve the current list of S4 classes (not sure this > exists). > > Another example of where this could be used would be the .jnew function > from rJava, where the first argument is a java class, associated with > something that can complete java class names.That should be useful (library, data, etc. are already hard-coded to do special completion, but there is no reason for them to be special). I'll have to think about how best to implement this. I should have time to work in this in a couple of weeks (I also hope to tackle your earlier request on $ completion then). -Deepayan
On Fri, 21 Aug 2009 11:21:03 +0200, Romain Francois <romain.francois at dbmail.com> wrote:> Hi, > > Would it be possible to add the capability for functions to register how > they would like to complete themselves. > > Currently, there is the .addFunctionInfo, but it allows only functions > to register a static list of potential completions, I was thinking of a > way to register not a fixed list of possible completions, but a > __function__ that would calculate completions dynamically. > > This could be useful for the "new" function in R, if associated with > something that can retrieve the current list of S4 classes (not sure > this exists). > > Another example of where this could be used would be the .jnew function > from rJava, where the first argument is a java class, associated with > something that can complete java class names.Not sure, but another example may be a class dependent completion for generic functions depending on first argument. Like print(df,... ) where df a data.frame to complete, digits = NULL, quote = FALSE, right = TRUE, row.names = TRUE instead of only (x,...). Vitalie. --
Reasonably Related Threads
- exec subdirectory of a package
- Remove all spaces from a string so it can be used by assign()
- [Fwd: Re: Video demo of using svSocket with data.table]
- How to show help in the same mode as where the commands is input?
- Why does the lexical analyzer drop comments ?