Bug 16409 - Autocomplete should work inside brackets without a space
Summary: Autocomplete should work inside brackets without a space
Alias: None
Product: R
Classification: Unclassified
Component: I/O (show other bugs)
Version: R 3.2.0
Hardware: Other Linux
: P5 enhancement
Assignee: R-core
Depends on:
Reported: 2015-06-03 14:53 UTC by Huji Lee
Modified: 2015-06-03 17:53 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Huji Lee 2015-06-03 14:53:32 UTC
To reproduce the bug, first create a variable:

df <- data.frame(v1 = 1, v2 = 1)

Then type the following and press TAB to get a list of suggestions:

df[ df$v

Erase the last input, type this one instead and press TAB again:


In the first case, R correctly suggests "v1" and "v2" as possibilities. In the second case it doesn't. I think it should.
Comment 1 Deepayan Sarkar 2015-06-03 17:53:20 UTC
Assuming this is about the readline interface, you can get this behavior by setting

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

There is a trade-off. 

df[1]$v [TAB]

would have worked before, but will now no longer work. 

In general, the completion mechanism works by using heuristics to identify a reasonable token that it could try to complete, and the heuristics sometimes fail. This is not optional in the readline interface (the heuristics are applied by readline).