[Sciviews-commits] r160 - in pkg: svMisc svMisc/R svTools svTools/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jul 30 10:23:04 CEST 2009
Author: romain
Date: 2009-07-30 10:23:02 +0200 (Thu, 30 Jul 2009)
New Revision: 160
Modified:
pkg/svMisc/NEWS
pkg/svMisc/R/CompletePlus.R
pkg/svTools/DESCRIPTION
pkg/svTools/NEWS
pkg/svTools/R/completion.R
Log:
handling completions like 'a[m' in CompletePlus and CompletePlusWrap
Modified: pkg/svMisc/NEWS
===================================================================
--- pkg/svMisc/NEWS 2009-07-30 07:56:50 UTC (rev 159)
+++ pkg/svMisc/NEWS 2009-07-30 08:23:02 UTC (rev 160)
@@ -4,6 +4,8 @@
* CompletePlus removes the weird object names ( .__M__, ...) which were
causing trouble
+
+* CompletePlus handles completions like "a[m"
== Changes in svMisc 0.9-48
Modified: pkg/svMisc/R/CompletePlus.R
===================================================================
--- pkg/svMisc/R/CompletePlus.R 2009-07-30 07:56:50 UTC (rev 159)
+++ pkg/svMisc/R/CompletePlus.R 2009-07-30 08:23:02 UTC (rev 160)
@@ -13,7 +13,18 @@
utils:::.completeToken()
comps <- utils:::.retrieveCompletions()
if (!length(comps)) return(invisible(NULL))
-
+
+ # For tokens like "a[m", the actual yoken should be "m"
+ # completions are modified accordingly
+ rx <- regexpr( "[[]+", token )
+ if( rx > 0 ){
+ # then we need to trim out whatever is before the [ in the completion
+ # and the token
+ start <- rx + attr( rx, "match.length" )
+ token <- substring( token, start )
+ comps <- substring( comps, start )
+ }
+
# remove weird object names ( useful when the token starts with "." )
comps <- comps[ !grepl( "^[.]__[[:alpha:]]__", comps ) ]
if (!length(comps))
@@ -109,6 +120,8 @@
# Make sure that arguments are witten 'arg = ', and not 'arg='
out[, 1] <- sub("=$", " = ", out[, 1])
+
+ attr( out, "token" ) <- token
if (simplify) {
cat(apply(out, 1, paste, collapse = "\t"), sep = "\n")
Modified: pkg/svTools/DESCRIPTION
===================================================================
--- pkg/svTools/DESCRIPTION 2009-07-30 07:56:50 UTC (rev 159)
+++ pkg/svTools/DESCRIPTION 2009-07-30 08:23:02 UTC (rev 160)
@@ -1,7 +1,7 @@
Package: svTools
Type: Package
Title: SciViews GUI API - Tools (wrapper for packages tools and codetools)
-Version: 0.0-7
+Version: 0.0-8
Date: 2009-06-29
Author: Romain Francois <francoisromain at free.fr>
Maintainer: Romain Francois <francoisromain at free.fr>
Modified: pkg/svTools/NEWS
===================================================================
--- pkg/svTools/NEWS 2009-07-30 07:56:50 UTC (rev 159)
+++ pkg/svTools/NEWS 2009-07-30 08:23:02 UTC (rev 160)
@@ -1,7 +1,7 @@
= svTools News
-== Changes in svTools 0.0-6
-* ...
+== Changes in svTools 0.0-8
+* handling the token better in CompletePlusWrap
== Version 0.0-5
First version on R-Forge.
Modified: pkg/svTools/R/completion.R
===================================================================
--- pkg/svTools/R/completion.R 2009-07-30 07:56:50 UTC (rev 159)
+++ pkg/svTools/R/completion.R 2009-07-30 08:23:02 UTC (rev 160)
@@ -2,8 +2,13 @@
CompletePlusWrap <- function( ... ){
out <- CompletePlus( ..., minlength = 1 )
if( is.null(out) ){
- out <- matrix( "", nc = 4, nr = 0 )
- }else{
+ out <- matrix( "", nc = 4, nr = 0 )
+ token <- utils:::.guessTokenFromLine( )
+ } else{
+ token <- attr( out, "token" )
+ if( is.null(token) ){
+ token <- utils:::.guessTokenFromLine( )
+ }
types <- rep( "function" , nrow(out ) )
completions <- out[,1]
types[ completions %~% "= *$" ] <- "argument"
@@ -11,14 +16,14 @@
# arguments first, then functions, then packages
out <- cbind( out, types ) [ order(types),, drop = FALSE ]
}
- token <- utils:::.guessTokenFromLine( )
+
fun <- utils:::inFunction()
- if(length(fun) && !is.na(fun)){
- tooltip <- CallTip( fun )
- } else {
- tooltip <- NULL
- fun <- ""
- }
+ if(length(fun) && !is.na(fun)){
+ tooltip <- CallTip( fun )
+ } else {
+ tooltip <- NULL
+ fun <- ""
+ }
list( data = out, token = token,
fun = fun, tooltip = tooltip )
More information about the Sciviews-commits
mailing list