go-lang-plugin-org / go-lang-idea-plugin

Google Go language IDE built using the IntelliJ Platform
https://plugins.jetbrains.com/plugin/5047
Other
4.56k stars 570 forks source link

Incorrect var/fn suggestions (GoConvey example) #2324

Open oharlem opened 8 years ago

oharlem commented 8 years ago
package main

func world() {
    println("world!")
}

func hello(what func()) {
    print("Hello ") 
    what()
}

func main() {
    hello(wor<caret>) // this produces world() instead of world
}

Original report

Hi,

When filling in an assertion with a GoConvey ( https://github.com/smartystreets/goconvey ), it gets an incorrect suggestion with a function instead of a variable (note the () after "ShouldEqual"):

So(actual, ShouldEqual(), expected)

Correct assertion would look like:

So(actual, ShouldEqual, expected)

The reason may be that a ShouldEqual var is treated as a function:

screen shot 2016-02-04 at 1 38 17 am

Not sure if should be submitted to GoConvey guys, as this may be related to a wider issue of what Go Idea Plugin should be suggesting - a var or a function behind it.

Please advise.

Thanks, D.

dlsniper commented 8 years ago

Hi, this is indeed from the plugin. Thank you for reporting it.