completor.vim icon indicating copy to clipboard operation
completor.vim copied to clipboard

Trigger completion when filling out go structs

Open blockloop opened this issue 7 years ago • 0 comments

There is no completion when defining Go structs.

Expected behavior: when filling a struct with fields I expect to see a list of fields suggested for autocompletion

Actual behavior: no completion is given

I tried the autocompletion snippet from the README

inoremap <expr> <Tab> pumvisible() ? "<C-N>" : "<C-R>=completor#do('complete')<CR>"

When pressing <TAB> in the cursor position listed below gocode -debug doesn't print any requests so it appears that completor is not sending anything. When I type Na I see the gocode request sent because of the g:completor_min_chars option as expected.

package main

type Person struct {
	Name string
	Age  uint8
}

func main() {
	p := &Person{
		// << cursor here
	}
}

My question is this:

Is there a way to trigger completion when entering a struct like above? I'd like to be able to see which fields I can set.

blockloop avatar Nov 10 '18 16:11 blockloop