[R-SIG-Mac] Enhanced Code Completion Suggestion

Hans-Joerg Bibiko bibiko at eva.mpg.de
Wed May 23 14:20:18 CEST 2007


Dear all,

I just wrote a code snippet to enhance R's code completion. Now it  
also includes completion for arguments (which contain '=') of the  
current function. Furthermore it toggles FALSE into TRUE and visa  
versa to avoid typing it ;)

My first scratch is the following:
note: [ '|' is indicating the cursor]
##
if you type:
dist(a, m|)

and then I press TAB it gives you now the following
method=
machine()
mad()
mahalanobis()
...

##
if you type:
dist(a, |)

and then I press TAB it gives you now all arguments containing '='
method=
diag=TRUE   toggled!
upper=TRUE  toggled!
p=

##
if you type:
matrix(c(1:3,|))

and then I press TAB it completes it at once to
matrix(c(1:3,recursive=TRUE))

##
if you type:
matrix(c(1:3,recursive=TRUE),b|)

and then I press TAB it gives you now the following
byrow=TRUE
backsolve()
balanceMethodsList()
...

because the cursor is located within the matrix function

####

I just tried it out some while and it turned out that by using the  
enhanced code completion you can save much more time and you decrease  
typos ;)

Is this something useful for other users as well?
Are there any comments?
Would it be better to separate the argument completion from the code  
completion by, e.g., pressing SHIFT+TAB?
...?

Cheers,

Hans



More information about the R-SIG-Mac mailing list