-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/gopls: feature: offer a quickfix to define a struct field on "has no field or method" error #70217
Comments
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
Sure, that seems like a reasonable feature. |
great, I will start the implementation taking the issue I mentioned into account as an example.
I couldn't find a similar GetCallStubInfo for structs, if Im just seeking poorly pls let me know |
There is probably another case to consider: f := Foo{
a: 3, // unknown field a in struct literal of type Foo
} This can be one more case for TypesFromContext, I've add |
@xzbdmw thanks, would be useful to extract the type properly. |
@dennypenta You don’t need to rebase! I will rebase on yours if your cl merge first :) |
gopls version
v0.16.2
go env
What did you do?
Having a cursor on a non defined field doesn't suggest a quickfix to declare a new struct field.
Recently a similar feature was merged #69692 to define a missing method.
However, the ability to make a field is missing.
What did you see happen?
no action suggested
What did you expect to see?
A suggested quick fix "Define a struct field" exists and create a field
Editor and settings
Logs
The text was updated successfully, but these errors were encountered: