1
0
mirror of https://github.com/golang/go synced 2024-11-05 19:46:11 -07:00
go/internal/lsp/source
Muir Manders 7e40e1726e internal/lsp: improve signatureHelp in various cases
- show signature for function calls whose function expression is not
  an object (e.g. the second call in foo()()). since the function name
  is not available, we use the generic "func"
- only provide signature help when the position is on or within the
  call expression parens. this is consistent with the one other lsp
  server i tried (java). this improves the gopls experience in emacs
  where lsp-mode is constantly calling "hover" and
  "signatureHelp" ("hover" should be preferred unless you are inside
  the function params list)
- use the entire signature type string as the label since that includes
  the return values, which are useful to see
- don't qualify the function name with its package. it looks funny to
  see "bytes.Cap()" as the help when you are in a call
  to (*bytes.Buffer).Cap(). it could be useful to include invocant
  type info, but leave it out for now since signature help is meant to
  focus on the function parameters.
- don't turn variadic args "foo ...int" into "foo []int" for the
  parameter information (i.e. maintain it as "foo ...int")
- when determining active parameter, count the space before a
  parameter name as being part of that parameter (e.g. the space
  before "b" in "func(a int, b int)")
- handle variadic params when determining the active param (i.e.
  highlight "foo(a int, *b ...string*)" on signature help for final
  param in `foo(123, "a", "b", "c")`
- don't generate an extra space in formatParams() for unnamed
  arguments

I also tweaked the signatureHelp server log message to include the
error message itself, and populated the server's logger in lsp_test.go
to aid in development.

Fixes golang/go#31448

Change-Id: Iefe0e1e3c531d17197c0fa997b949174475a276c
GitHub-Last-Rev: 5c0b8ebd87a8c05d5d8f519ea096f94e89c77e2c
GitHub-Pull-Request: golang/tools#82
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172439
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-17 18:10:49 +00:00
..
analysis.go internal/lsp: use new go/packages LoadMode to get TypesSizes 2019-03-29 21:52:04 +00:00
completion.go internal/lsp: improve signatureHelp in various cases 2019-04-17 18:10:49 +00:00
definition.go internal/lsp: handle definitions for variables with error types 2019-04-15 20:59:51 +00:00
diagnostics.go internal/lsp: set the diagnostic source earlier 2019-04-17 00:57: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: normalise and make public diff<->edit conversions 2019-04-15 20:31:36 +00:00
highlight.go internal/lsp: add support for document highlight 2019-03-26 19:08:20 +00:00
signature_help.go internal/lsp: improve signatureHelp in various cases 2019-04-17 18:10:49 +00:00
symbols.go internal/lsp: fix crash when there is a type alias to a struct in the symbols code 2019-04-16 15:17:39 +00:00
view.go internal/lsp: normalise and make public diff<->edit conversions 2019-04-15 20:31:36 +00:00