holgerbrandl / r4intellij

An integration of the R programming language into Intellij IDEA
BSD 2-Clause "Simplified" License
148 stars 28 forks source link

Completion suggests wrong name first #225

Open rillig opened 5 years ago

rillig commented 5 years ago

I expect the code completion to list the most relevant completion first. This doesn't happen in the following case:

image

f <- function() {
    c <- 'local'
    c
}

The c from base is suggested first, even though there is a local variable of the same name. Consequently, when I press Enter, parentheses are inserted even though a string is not callable.

More generally, r4intellij should prefer local variables over variables further away, since these are typically accessed more frequently.