Skip to content
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

Struct autocompletion does not work anymore #480

Closed
lloiser opened this issue Oct 13, 2017 · 2 comments
Closed

Struct autocompletion does not work anymore #480

lloiser opened this issue Oct 13, 2017 · 2 comments

Comments

@lloiser
Copy link

lloiser commented Oct 13, 2017

Given that gocode is checked out with commit: 1a78dd6 (= current HEAD at the time of writing this)

And I have the following code

main.go
lib
|_ foo.go

foo.go contains:

package lib

type Foo struct {
	Bar string
}

and main.go:

package main

import (
	"path/to/lib"
	"fmt"
)

func main() {
	tmp := lib.Foo{
		
	}
	fmt.Println(tmp)
}

where # is my cursor.

Note: this only happens if the Foo struct is in another package.

When I try to autocomplete this (e.g. gocode autocomplete main.go 81)

Expected:
I only get Bar because my cursor is inside the struct

2017/10/13 08:18:01 Number of candidates found: 1
2017/10/13 08:18:01 Candidates are:
2017/10/13 08:18:01   var Bar string
2017/10/13 08:18:01 =======================================================

Actual:
I get all "global" candidates:

2017/10/13 08:17:11 Number of candidates found: 43
2017/10/13 08:17:11 Candidates are:
2017/10/13 08:17:11   const false 
2017/10/13 08:17:11   const iota 
2017/10/13 08:17:11   const nil 
2017/10/13 08:17:11   const true 
2017/10/13 08:17:11   func append([]type, ...type) []type
2017/10/13 08:17:11   func cap(container) int
2017/10/13 08:17:11   func close(channel)
2017/10/13 08:17:11   func complex(real, imag) complex
2017/10/13 08:17:11   func copy(dst, src)
2017/10/13 08:17:11   func delete(map[typeA]typeB, typeA)
2017/10/13 08:17:11   func imag(complex)
2017/10/13 08:17:11   func len(container) int
2017/10/13 08:17:11   func main()
2017/10/13 08:17:11   func make(type, len[, cap]) type
2017/10/13 08:17:11   func new(type) *type
2017/10/13 08:17:11   func panic(interface{})
2017/10/13 08:17:11   func print(...interface{})
2017/10/13 08:17:11   func println(...interface{})
2017/10/13 08:17:11   func real(complex)
2017/10/13 08:17:11   func recover() interface{}
2017/10/13 08:17:11   package fmt 
2017/10/13 08:17:11   package lib 
2017/10/13 08:17:11   type bool built-in
2017/10/13 08:17:11   type byte built-in
2017/10/13 08:17:11   type complex128 built-in
2017/10/13 08:17:11   type complex64 built-in
2017/10/13 08:17:11   type error interface
2017/10/13 08:17:11   type float32 built-in
2017/10/13 08:17:11   type float64 built-in
2017/10/13 08:17:11   type int built-in
2017/10/13 08:17:11   type int16 built-in
2017/10/13 08:17:11   type int32 built-in
2017/10/13 08:17:11   type int64 built-in
2017/10/13 08:17:11   type int8 built-in
2017/10/13 08:17:11   type rune built-in
2017/10/13 08:17:11   type string built-in
2017/10/13 08:17:11   type uint built-in
2017/10/13 08:17:11   type uint16 built-in
2017/10/13 08:17:11   type uint32 built-in
2017/10/13 08:17:11   type uint64 built-in
2017/10/13 08:17:11   type uint8 built-in
2017/10/13 08:17:11   type uintptr built-in
2017/10/13 08:17:11   var tmp lib.Foo
2017/10/13 08:17:11 =======================================================

Problem:

Checking out the parent commit c7fddb3 returns the correct suggestions. So I assume that 1a78dd6 has introduced a bug.

(source: joefitzgerald/go-plus#598 (comment))

@nsf
Copy link
Owner

nsf commented Oct 13, 2017

Should work now, sorry about that. Just pushed the commit.

@lloiser
Copy link
Author

lloiser commented Oct 13, 2017

Thx for your quick fix, amazing! 🎉

@lloiser lloiser closed this as completed Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants