This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 645
Completion doesn't work in go 1.9 for type aliases #1277
Comments
@esemplastic Can you provide a smaller code sample that I can try to repro this on? |
Sure! 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 @esemplastic, I can repro The issue lies with gocode and I see that the corresponding issue there is being looked at. Will close this issue as you have the upstream one to track the problem. When gocode is fixed for working with type alias, please drop a comment here so that others who might encounter the same issue will know to update gocode |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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!
This issue is also posted at nsf/gocode repository: nsf/gocode#479
The text was updated successfully, but these errors were encountered: