Quantcast

Re: [ESS] completion in [] (R internal completion fails)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [ESS] completion in [] (R internal completion fails)

Vitalie Spinu

Hello,

I am forwarding this from ESS mailing list, as it's a failure of
internal R completion system:

This fails:

utils:::.assignLinebuffer('iris[iris$Spec')
utils:::.assignEnd(15)
utils:::.guessTokenFromLine()
utils:::.completeToken()
utils:::.retrieveCompletions() ## -> [1] "iris[iris$Spec"

This works

utils:::.assignLinebuffer('iris[ iris$Spec')  # note the space after [
utils:::.assignEnd(15)
utils:::.guessTokenFromLine()
utils:::.completeToken()
utils:::.retrieveCompletions() ## -> [1] "iris$Species"

Best,
Vitalie.

>>>> Andreas Leha <[hidden email]>
>>>> on Wed, 14 Mar 2012 10:21:37 +0100 wrote:

  >> Hi all,
  >> I am seeing strange behaviour with completion inside [].

  >> Suppose I have
  >> ttt <- data.frame(aaa=1, bbb=1)
  >> and I want to run
  >> ttt$aaa[ttt$aaa == 1] <- 2

  >> then completion at this point fails:
  >> ttt$aaa[ttt$aa<TAB>

  >> On the other hand, strangly enough, this works as expected:
  >> ttt$aaa[ ttt$aa<TAB>

  >> Regards,
  >> Andreas

  >> ______________________________________________
  >> [hidden email] mailing list
  >> https://stat.ethz.ch/mailman/listinfo/ess-help

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [ESS] completion in [] (R internal completion fails)

Deepayan Sarkar
On Wed, Mar 14, 2012 at 3:27 PM, Vitalie Spinu <[hidden email]> wrote:

>
> Hello,
>
> I am forwarding this from ESS mailing list, as it's a failure of
> internal R completion system:
>
> This fails:
>
> utils:::.assignLinebuffer('iris[iris$Spec')
> utils:::.assignEnd(15)
> utils:::.guessTokenFromLine()
> utils:::.completeToken()
> utils:::.retrieveCompletions() ## -> [1] "iris[iris$Spec"
>
> This works
>
> utils:::.assignLinebuffer('iris[ iris$Spec')  # note the space after [
> utils:::.assignEnd(15)
> utils:::.guessTokenFromLine()
> utils:::.completeToken()
> utils:::.retrieveCompletions() ## -> [1] "iris$Species"

This is controlled by

> getOption("rl_word_breaks")
[1] " \t\n\"\\'`><=%;,|&{()}"

Basically [ does not break words into tokens (space does). You can
change this to

options(rl_word_breaks = paste(getOption("rl_word_breaks"), "[]", sep = ""))

But then the following won't work:

> x = list(aaa = list(AAA = 1, BBB = 2))
> x[[1]]$A<TAB>

-Deepayan


> Best,
> Vitalie.
>
>>>>> Andreas Leha <[hidden email]>
>>>>> on Wed, 14 Mar 2012 10:21:37 +0100 wrote:
>
>  >> Hi all,
>  >> I am seeing strange behaviour with completion inside [].
>
>  >> Suppose I have
>  >> ttt <- data.frame(aaa=1, bbb=1)
>  >> and I want to run
>  >> ttt$aaa[ttt$aaa == 1] <- 2
>
>  >> then completion at this point fails:
>  >> ttt$aaa[ttt$aa<TAB>
>
>  >> On the other hand, strangly enough, this works as expected:
>  >> ttt$aaa[ ttt$aa<TAB>
>
>  >> Regards,
>  >> Andreas
>
>  >> ______________________________________________
>  >> [hidden email] mailing list
>  >> https://stat.ethz.ch/mailman/listinfo/ess-help
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Loading...