x/tools/gopls: Support More postfix completion for map, slice. (len, for, forr) #64037
Labels
FeatureRequest
Issues asking for a new feature that does not need a proposal.
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
help wanted
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Describe the solution you'd like
I was using Goland before, but now I have switched to neovim. The suffix completion provided in Goland is really powerful, and I hope gopls can offer the same experience. I noticed that gopls already supports some suffix completion, but not enough. I hope more can be added. I'm not sure what considerations are involved in determining if a completion should be integrated into gopls, but I will provide some suggestions that I think are meaningful.
len is a very high-frequency function, providing suffix completion can greatly improve coding experience. When dealing with a nested structure, for example, a.b.c.d, when I obtain the d field, I find that it is a slice. It may be necessary to first check the length when processing it. In this case, it would be very useful if suffix completion can be directly applied.
to
Iterating over slices and maps is a common operation, and suffix completion allows you to focus on the data itself, which provides a better experience. I know that there is already suffix completion "range", but I think the name is not very good, considering that most people think of "for" first when iterating over data.
to
In Go, there are two types of traversal: one that only traverses the index and one that traverses both the index and value at the same time. Different situations may require different methods, so it makes sense to distinguish between these two types.
to
I'm looking at the code handling this part in gopls. I'm interested in lsp and I'm willing to provide some help if possible.
The text was updated successfully, but these errors were encountered: