1
0
mirror of https://github.com/golang/go synced 2024-09-30 14:18:32 -06:00
go/internal/span
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
..
parse.go internal/span: change to private fields 2019-03-15 18:05:47 +00:00
span_test.go internal/span: change to private fields 2019-03-15 18:05:47 +00:00
span.go internal/span: change to private fields 2019-03-15 18:05:47 +00:00
token111.go internal/span: adding a source location package to unify the pos conversions 2019-03-08 14:21:31 +00:00
token112.go internal/span: adding a source location package to unify the pos conversions 2019-03-08 14:21:31 +00:00
token_test.go internal/span: change to private fields 2019-03-15 18:05:47 +00:00
token.go internal/lsp: improve signatureHelp in various cases 2019-04-17 18:10:49 +00:00
uri_test.go internal/span: adding a source location package to unify the pos conversions 2019-03-08 14:21:31 +00:00
uri.go internal/lsp: unescape uris before we convert them to span.URI 2019-03-27 16:50:41 +00:00
utf16_test.go internal/span: change to private fields 2019-03-15 18:05:47 +00:00
utf16.go go/packages: add support for entire packages defined in overlays 2019-04-17 17:55:51 +00:00