1

Autocomplete for Go code (fantastically) suggests functions and helpfully shows the documentation for the function, e.g. arguments and return types.

Example completion

If I hit tab, the DialHTTP function is inserted.

My question: is it possible to insert a "template" of the argument call? Since autocomplete shows the arguments, I would like to have this line inserted when I press tab:

client, err := rpc.DialHTTP(network, address)

Then I can replace the arguments with my arguments.

1 Answer 1

2

If you install yasnippet and ac-go-expand-arguments-into-snippets is non-nil(Default is t) then argument snippet is expanded like following animation gif.

enter image description here

company-mode provides such feature by itself, so you can use it without yasnippet by company-mode.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.