gocode icon indicating copy to clipboard operation
gocode copied to clipboard

Struct fields autocompletion

Open DisposaBoy opened this issue 12 years ago • 6 comments

It would be nice if gocode offered completion of struct fields. I can do it on the client side by placing a dot after the type and then requesting completion from there but I'm wondering if this is something better implemented in gocode if possble that way all users of gocode can benefit

e.g.

package main

type T struct {
    N int
    S string
}

func main() {
    t := T{
        |cursor|<results in completion of globals>
    }
}

DisposaBoy avatar Feb 15 '13 19:02 DisposaBoy

Yeah, I thought about that, but don't know if and when I'll add this, shouldn't be too hard.

nsf avatar Feb 16 '13 00:02 nsf

this would be very,very great. It appears that struct initialization is a very frequent code pattern.

ericaro avatar Dec 04 '13 08:12 ericaro

At the moment, I'm pretty sure, I won't implement it soon. I'm in support-only mode for the gocode, because I don't really write much Go lately.

nsf avatar Dec 04 '13 14:12 nsf

I'm tentatively working on this, and I almost have a version that works correctly, at least under certain conditions (identifier on its own at start of line).

tiziano88 avatar Apr 01 '14 00:04 tiziano88

I must type some char, and then gocode prompt available fields. But I want gocode auto show all available fields when I start open the struct brace. Can I do it, shall I make some configure?

guileen avatar Jun 24 '15 03:06 guileen

@guileen It's editor specific, what editor are you using?

nsf avatar Jun 24 '15 06:06 nsf