1
0
mirror of https://github.com/golang/go synced 2024-10-01 05:18:33 -06:00
go/internal/lsp/source
Muir Manders 431033348d internal/lsp: fix function value completions
Previously we would always expand *types.Func completion candidates to
function calls, even if the expected type matched the function itself,
not its return value. Now we check the function itself before we check
its return value. This fixes cases like this:

func foo() int { return 0 }
var f func() int
f = <foo> // now completes to "foo" instead of "foo()"

Also, *types.Var function values were never getting expanded to calls.
I fixed the completion formatting to know that both *types.Func
and *types.Var objects might need to be invoked in the completion
item. This fixes cases like this:

foo := func() int { return 0 }
var i int
i = <foo()> // now completes to "foo()" instead of "foo"

Change-Id: I8d0e9e2774f92866a3dd881092c13019fb3f3fd5
GitHub-Last-Rev: 7442bc84b5bbb86296289bbc745ec56a5f89d901
GitHub-Pull-Request: golang/tools#122
Reviewed-on: https://go-review.googlesource.com/c/tools/+/182879
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-06-20 15:43:39 +00:00
..
analysis.go internal/lsp: update analysis runner for new features 2019-06-14 15:20:01 +00:00
completion_format.go internal/lsp: fix function value completions 2019-06-20 15:43:39 +00:00
completion_snippet.go internal/lsp: build the packages config on demand from proper configuration 2019-05-21 17:12:43 +00:00
completion.go internal/lsp: fix function value completions 2019-06-20 15:43:39 +00:00
diagnostics_test.go internal/span: change URI.Filename so it just returns the filename 2019-06-10 21:39:43 +00:00
diagnostics.go internal/lsp: add a field on the package to store diagnostics 2019-06-19 16:20:43 +00:00
enums.go internal/lsp: switch completion item tests to using the enum strings 2019-04-17 17:57:43 +00:00
format.go internal/lsp: remove source.FileContent 2019-06-06 05:02:23 +00:00
highlight.go internal/lsp: build the packages config on demand from proper configuration 2019-05-21 17:12:43 +00:00
hover.go internal/lsp: attach documentation to signature help 2019-06-06 17:46:28 +00:00
identifier.go internal/lsp: fix references for type switch vars 2019-06-19 18:18:01 +00:00
references.go internal/lsp: fix references for type switch vars 2019-06-19 18:18:01 +00:00
rename.go internal/lsp: add identifier renaming 2019-06-19 21:54:42 +00:00
signature_help.go internal/lsp: fix some issues with trimming ASTs 2019-06-07 20:08:10 +00:00
source_test.go internal/lsp: add identifier renaming 2019-06-19 21:54:42 +00:00
symbols.go internal/lsp: build the packages config on demand from proper configuration 2019-05-21 17:12:43 +00:00
util.go internal/lsp: fix function value completions 2019-06-20 15:43:39 +00:00
view.go internal/lsp: add a field on the package to store diagnostics 2019-06-19 16:20:43 +00:00