x/tools/gopls: completing inside new()
suggests keywords first
#40274
Labels
Milestone
Comments
Change https://golang.org/cl/246360 mentions this issue: |
gopherbot
pushed a commit
to golang/tools
that referenced
this issue
Aug 12, 2020
Tweak a few things so that unnamed, non-basic types are offered as completions in certain cases: var _ []int = make(<>) // now properly suggests "[]int" I also fixed type related keywords to not be offered if there is an expected type: var _ *int = new(<>) // don't offer "func", etc. There are still some cases that don't work properly. For example: var _ [][]int = make([]<>) // doesn't offer "[]int" This would be harder to fix given the way things currently work. Fixes golang/go#40275, golang/go#40274. Change-Id: I2577d5863d4757845ad3ff7dbb125106b649a6b6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/246360 Run-TryBot: Muir Manders <muir@mnd.rs> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Didn't do "Fixes" comment right, but this was fixed in above CL. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Completing inside
new()
should offerint
first, but it instead offerschan
,func
,map
, and thenint
.Probably
addKeywordCompletions
shouldn't add keyword type name candidates if there is already an expected type (int
is the expected type in the above example).The text was updated successfully, but these errors were encountered: