You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the issues and docs and I found (GoImpl and GoGenerate), none of which seem to provide this functionality. This seems like something that would exist, or at least have been considered.
I personally think it could be useful if you could generate a function or method stub for an un-implemented function or method under the cursor. Open to thoughts as this would be something that I would be interested in doing.
package main
import path/to/pkg
var s pkg.S{}
s.UnimplementedMethod(1, 1.0, "one")
pkg.UnimplementedFunction(1, 1.0, "one")
While the cursor was over the UnimplementedMethod method, you could run :GoGenerateStub or something.
package pkg
type S struct {}
func (s *S) UnimplementedMethod(a int, b float64, c string) {}
And it would generate the following and if you hovered over the UnimplementedFunction function.
package pkg
...
func UnimplementedFunction(a int, b float64, c string) {}
Some Complexities to Consider
would need to pick up on user's type variable in front of method (i.e., (s *Struct))
could also stub return values, but would be more difficult to pick up on types based on use (would we just default to int, defaulting seems unacceptable)
Additional Notes
I think GoImpl would be a good place to start looking at how this could be done
This is my first issue on an open source project, so please let me know if I am doing something wrong.
The text was updated successfully, but these errors were encountered:
mccurdyc
changed the title
idea: Generate Method Stub for Un-Implemented Method
idea: Generate Method/Function Stub for Un-Implemented Method or Function
Oct 6, 2018
I read the issues and docs and I found (
GoImpl
andGoGenerate
), none of which seem to provide this functionality. This seems like something that would exist, or at least have been considered.I personally think it could be useful if you could generate a function or method stub for an un-implemented function or method under the cursor. Open to thoughts as this would be something that I would be interested in doing.
While the cursor was over the
UnimplementedMethod
method, you could run :GoGenerateStub or something.And it would generate the following and if you hovered over the
UnimplementedFunction
function.Some Complexities to Consider
(s *Struct)
)int
, defaulting seems unacceptable)Additional Notes
GoImpl
would be a good place to start looking at how this could be doneThis is my first issue on an open source project, so please let me know if I am doing something wrong.
The text was updated successfully, but these errors were encountered: