-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completion doesn't work in go 1.9 for type aliases #479
Comments
Struct autocompletion should work now, sorry about breaking it in a recent commit. Will have a look at type aliases, but they should work. I haven't tested them on cross-package boundaries though. Most likely will have a look at it this weekend. |
Thanks for answering but it doesn't work, I did the update with file: mypackage/original/embedded_struct.go package original
type C struct {
Field string
Field2 int
}
func (c *C) BeginRequest() {
} file: mypackage/original/return_type.go package original
type Result interface {
DoSomething()
}
type Response struct {
Text string
}
func (r Response) DoSomething() {
} file: mypackage/mypackage.go package mypackage
import (
"esemplastic/mypackage/original"
)
type (
C = original.C
Result = original.Result
Response = original.Response
) file: main.go package main
import (
"esemplastic/mypackage"
)
type ExampleController struct {
mypackage.C
}
func (ex *ExampleController) Get() {
// `ex.` doesn't give completion for the mypackage.C's:
// Field string
// Field2 int
// neither the function `BeginRequest()`,
// it only shows the field `C` and its own function `Get`.
// but `ex.Field` or `ex.BeginRequest` is compiled and ran without errors.
// The `ex.C.` gives completion help.
}
func (ex *ExampleController) ReturnSomething() mypackage.Result {
return mypackage.Response{
// field: Text string is not shown to completion help,
// nothing except the built go functions like `append`...
}
}
func main() {
} Thanks! |
Ok, take a look please. It was a local issue (it has nothing to do with cross package boundaries). But I tested it on "iris" lib just in case. If it works for you, feel free to close the issue. If you spot any other problems with type aliases let me know. At this point there is no clear solution for type aliases in gocode, it's all just hacks on a case by case basis. But it sort of works. |
@esemplastic If you have installed Go via |
iris.C
's origin type ismvc.C
: https://github.com/kataras/iris/blob/master/mvc/controller.go#L39iris.C
type alias definition: https://github.com/kataras/iris/blob/master/go19.go#L148The mvc.C looks like the following:
But when embedding the type in other type, auto completion doesn't work:
Same for non-embedding, i.e return a struct that derives from a type alias:
Is this a bug, is it a feature request? I don't know but please try to look on this and fix that as soon as possible!
The text was updated successfully, but these errors were encountered: