Skip to content
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: preserve comments when invoking fillstruct on partially filled composite literals #71312

Closed
findleyr opened this issue Jan 17, 2025 · 3 comments
Assignees
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Member

It looks like in #39804, there was a desire to preserve comments when filling partial literals, but it was deemed too challenging.

I think with recent work by @madelinekalil to reassemble the resulting literal, this should be a solvable problem, and a nice UX improvement.

Tentatively assigning for v0.18.0. It would be nice to bundle this improvement.

@findleyr findleyr added this to the gopls/v0.18.0 milestone Jan 17, 2025
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jan 17, 2025
@gabyhelp gabyhelp added the FeatureRequest Issues asking for a new feature that does not need a proposal. label Jan 17, 2025
@xzbdmw
Copy link

xzbdmw commented Jan 17, 2025

I think with recent work by @madelinekalil to reassemble the resulting literal, this should be a solvable problem, and a nice UX improvement.

Does this mean we manipulate string literals for each field? I was trying to attach snippets on fillstrcut when clients have capabilities (#70432) , and thought I have to do that too.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/643696 mentions this issue: gopls/internal/analysis/fillstruct: fillstruct

gopherbot pushed a commit to golang/tools that referenced this issue Jan 28, 2025
Modifies fillstruct refactoring to preserve the formatting
and order of prefilled struct elements and comments.

Fixes golang/go#70690, golang/go#71312

Change-Id: I0879d22a392e6c3ab85621420e54eb2e4651a1db
Reviewed-on: https://go-review.googlesource.com/c/tools/+/643696
Reviewed-by: Alan Donovan <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
@findleyr
Copy link
Member Author

findleyr commented Jan 30, 2025

This was fixed by https://go.dev/cl/643696

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants