-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Closed
Copy link
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.help wanted
Milestone
Description
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
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.
a.b.c.d.len|
to
len(a.b.c.d)
- for
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.
s = make([]int, 3)
s.for|
to
s = make([]int, 3)
for i| := range s {
}
- forr
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.
s = make([]int, 3)
s.for|
to
s = make([]int, 3)
for i|, v := range s {
}
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.
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.help wanted