1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:54:42 -07:00
go/internal/lsp
Muir Manders 5a76f03bc7 internal/lsp: fix variadic interface completion ranking
In cases like:

var foo []io.Writer
var buf *bytes.Buffer
foo = append(foo, <>)

we weren't giving "buf" a good score. When comparing the candidate
type *bytes.Buffer to the (variadic) expected type []io.Writer we were
turning the candidate type into []*bytes.Buffer. However, of course,
[]*bytes.Buffer is not assignable to []io.Writer, so the types didn't
match. Now we instead turn the expected type []io.Writer into
io.Writer and compare to *bytes.Buffer.

I fixed the @rank test note to check that the candidates' scores are
strictly decreasing. Previously it would allow candidates with the
same score if they happened to be in the right order. This made it
easier to right a test for this issue, but also uncovered an issue
with untyped completion logic. I fixed it to do the untyped constant
check if _either_ the expected or candidate type is
untyped (previously it required the candidate type to be untyped).

Fixes golang/go#35625.

Change-Id: I9a837d6a781669cb7a2f1d6d3d7f360c85be49eb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/207518
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-18 05:14:29 +00:00
..
browser internal/lsp: add version and bug commands 2019-05-11 04:16:02 +00:00
cache internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
cmd internal/lsp/source: add support for references in the same workspace 2019-11-14 20:04:27 +00:00
debug internal/lsp: fix the debug info pages 2019-11-04 23:16:26 +00:00
diff internal/lsp: fix unified diffs of edits at the end of a file 2019-10-11 16:38:14 +00:00
fuzzy internal/lsp: fix fuzzy matcher inconsistency 2019-10-22 21:05:28 +00:00
protocol lsp/protocol/typescript: add instructions for typescript compiling 2019-11-13 18:38:21 +00:00
snippet all: fix broken links to LSP specification 2019-10-02 18:32:53 +00:00
source internal/lsp: fix variadic interface completion ranking 2019-11-18 05:14:29 +00:00
telemetry internal/lsp: call load in (*session).NewView 2019-11-07 23:34:59 +00:00
testdata internal/lsp: fix variadic interface completion ranking 2019-11-18 05:14:29 +00:00
tests internal/lsp: fix variadic interface completion ranking 2019-11-18 05:14:29 +00:00
code_action.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
command.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
completion_test.go internal/lsp: fix variadic interface completion ranking 2019-11-18 05:14:29 +00:00
completion.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
definition.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
diagnostics.go go/analysis, internal/lsp: add support for related information 2019-10-21 19:00:55 +00:00
folding_range.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
format.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
general.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
highlight.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
hover.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
implementation.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
link.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
lsp_test.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
references.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
rename.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
reset_golden.sh internal/lsp: fix regeneration of golden files 2019-09-25 13:16:59 +00:00
server.go internal/lsp: handle the didChangeConfiguration message 2019-11-12 16:15:42 +00:00
signature_help.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
symbols.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
text_synchronization.go internal/lsp: fix panic in bestView 2019-11-16 21:44:31 +00:00
watched_files.go internal/lsp/cache: add finer-grained control of file changes 2019-11-14 16:11:15 +00:00
workspace.go internal/lsp: handle the didChangeConfiguration message 2019-11-12 16:15:42 +00:00