-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
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.
Milestone
Description
type foo struct { i int }
var bar []foo
bar = append(bar, <>)Currently in the above example gopls prefers "bar" at "<>", but it's rare that you append a slice to itself. I think we should adjust scoring so that the literal candidate "foo{}" is ranked above "bar".
We could add a special case to downrank the first append param as the second append param, but I'm not sure the best way to do it. If we just check types.Object equality, we will incorrectly dowrank in the following case:
type foo struct { i []int }
var a, b foo
a.i = append(a.i, <>)At "<>" we would downrank "b.i" in addition to "a.i". To avoid this we would need to use objectpath or AST/text equality check.
Reactions are currently unavailable
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.