GoSublime
GoSublime copied to clipboard
Prevent autocompletion of functions
How do I prevent the function signature from being autocompleted and pre-filled? For example if I type strconv.ParseInt, and then press tab, it turns into this:
strconv.ParseInt(s, base, bitSize)
I'd rather it just completed the function name, and showed me the function signature in the status bar.
Any update on this?
I don't really want to add any more configuration because it makes maintenance a burden so hopefully the following reducer will suffice:
mg.NewReducer(func(mx *mg.Ctx) *mg.State {
if !mx.LangIs(mg.Go) || !mx.ActionIs(mg.QueryCompletions{}) {
return mx.State
}
mx.Defer(func(mx *mg.Ctx) *mg.State {
if len(mx.Completions) == 0 {
return mx.State
}
cl := make([]mg.Completion, len(mx.State.Completions))
for i, c := range mx.State.Completions {
if pos := strings.IndexByte(c.Src, '('); pos > 0 && c.Tag == mg.FunctionTag {
c.Src = c.Src[:pos]
}
cl[i] = c
}
return mx.State.Copy(func(st *mg.State) { st.Completions = cl })
})
return mx.State
}),