func Complete(p *project.Project, pfile *file.File, off int) Candidates { tmpPath := p.GetProjectPath() + "/.tmp/" + pfile.GetPath() pfile.SaveAs(tmpPath) src := pfile.GetBody() cur := getCursor(src, off) // fmt.Println(src[off-3:off] + "|" + src[off:off+3]) //TODO cands := gocode(p, tmpPath, cur) cands = append(cands, keywords(cur)...) cands = append(cands, packages(cur, pfile)...) cands = append(cands, funcsRecv(cur)...) cands.Sort() ret := Candidates{} ret = append(ret, Candidate{Name: cur.partial, Perc: 200}) i := 0 for _, c := range cands { if c.Perc < 0 && i > 10 { break } ret = append(ret, c) i++ } return ret }