Function autocomplete with parameter placeholders

已回答

I just bought GoLand but I can't seem to find a way to autocomplete a function with all default parameters in.

By example when I'm trying to use the function HandleFunc from the net/http package, I start typing http.HandleFunc and then tab to select the right autocomplete, I would suspect this would autocomplete to the following, so I can just swap out the default arguments:

http.HandleFunc(pattern string, handler func(ResponseWriter, *Request))

Instead it autocompletes to the following, which is pretty useless for me:

http.HandleFunc()

 

Screenshot: upload id 2020_12_10_Aah4Xh81JPE7Zk31

0
正式评论

Hello Dennis,

The current way of filling arguments in function is slightly different:

  1. Enter the package name and then start typing the method name, e.g., http.HandleF.
  2. Wait for half a second or call the Parameter Info action manually (CMD+P).
  3. Enter the first parameter, then specify func for the second parameter.
  4. Press tab/enter.
  5. Specify function parameters or leave them as default by pressing enter.
  6. Continue to fill the body of the function and so on.

Could you try working this way for a while and then write the result, please? What are the disadvantages of this approach, and what is your workflow?

I look forward to hearing from you.

请先登录再写评论。