-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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 :) |
folks, I dare to ask a couple things since Im a first time contributor.
|
In order to be merged, yes, there must be no conflicts. But we can review your code if the conflicts are minor.
Pinging this issue (as you did) is effective.
We don't use GitHub PRs; instead we review CLs in Gerrit, which has much better ergonomics. I wasn't aware of the PR at all; I guess it uses GitHub notifications, which I must have suppressed because they are too numerous. There is a robot that causes GitHub PRs to be mirrored as Gerrit CLs (your CL is https://go.dev/cl/628877) but since none of the team were named as reviewers it didn't come to our attention. Now that it has, I will take a look at your code. |
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: