1
0
mirror of https://github.com/golang/go synced 2024-10-01 12:28:37 -06:00
Commit Graph

3226 Commits

Author SHA1 Message Date
Jay Conrod
15bbd99efc all: run go mod tidy
This adds golang.org/x/sync.
Needed by golang.org/x/tools/internal/lsp/source.

Change-Id: Id42e597be74ed6cb1b7c30c172c5efb3f1c0f2b1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173481
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-23 23:23:28 +00:00
Muir Manders
49ba83114e internal/lsp: improve composite literal completion
When the value of a composite literal key/value pair was unparsable,
you were getting completions for the composite literal keys instead of
values. For example "struct { foo int }{foo: []<>" was completing to
the field name "foo". This was because the leaf ast.Node at the cursor
was the composite literal itself, and our go-back-one-character logic
was not happening because the preceding character's node
was *ast.BadExpr, not *ast.Ident. Fix by always generating the ast
path for the character before the cursor's position. I couldn't find
any cases where this broke completion.

I also added expected type detection for the following composite
literal cases:
- array/slice literals
- struct literals (both implicit and explicit field names)
- map keys and values

Fixes golang/go#29153

Change-Id: If8cf678cbd743a970f52893fcf4a9b83ea06d7e9
GitHub-Last-Rev: f385705cc05eb98132e20561451dbb8c39b68519
GitHub-Pull-Request: golang/tools#86
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173099
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-23 22:28:03 +00:00
Ian Cottrell
18110c573c internal/lsp: delay the running of gofmt until the test is running
Change-Id: I222c83313a6366367fbeb7ce7d08058968d3a08e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173340
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-23 21:55:36 +00:00
Ian Cottrell
2acd0f4c51 internal/lsp: adding golden file support to the test harness
Also convert the format tests to use it. This means that the build bots no
longer need to run gofmt.

Change-Id: I5cb9d239183b17d81fdb00b38e9099d224c07e6a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172973
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-23 21:54:59 +00:00
Jonathan Amsterdam
fe54fb3517 apidiff: represent a Report as a list of Changes
Modify the Report representation to be a list of Change values,
instead of two string slices.

This will enable adding more information to each change, like source
location.

Change-Id: Ia7389d7bc552479ea5e06efd7fdefe004058e66f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172777
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-22 23:39:26 +00:00
Rebecca Stambler
c6b416e8a4 internal/lsp: add more error handling to analysis
Updates golang/go#30786

Change-Id: Icf054b9bcd62b36e3aa55288946a9f0d1c845300
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172972
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-22 21:49:46 +00:00
Rebecca Stambler
3ff669b183 internal/lsp: add check for nil package
Fixes golang/go#31604

Change-Id: I60ec000d505c64783e5f51f62d168dc31c2fbe19
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172968
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-22 21:23:51 +00:00
Rebecca Stambler
1e2181f3f4 internal/lsp: add additional debug logging for diagnostics
This change adds detailed debug logging for lsp.Diagnostics. This is
necessary for further investigation of cases where diagnostics aren't
propagated after a "didChange" request.

Updates golang/go#30786

Change-Id: I30eabf5a1cb17d4538a8860310b450494626b76f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172971
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-22 21:11:31 +00:00
Koichi Shiraishi
61c0d37527 internal/lsp: fix typo on 'textDocument/foldingRange' method
LSP specification define 'foldingRange', not 'foldingRanges'.
Just trims end of 's' and rename interface method name.

ref: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/specification.md#folding-range-request-leftwards_arrow_with_hook

Change-Id: Ie2a91f6c0bdd99b8ae9000ba87c24118b264b934
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173079
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-22 18:44:13 +00:00
micnncim
15d5d381ff internal/lsp: fix error handling in cmd
Found unnecessary error handling so removed.

Change-Id: I1a48e73186425291fdb0ede963b92ef6c9ce0ed8
GitHub-Last-Rev: d5cf67cb4a418bdc81dbd32eef9afb567ae4ff15
GitHub-Pull-Request: golang/tools#84
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173097
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-22 18:06:12 +00:00
micnncim
75f23652ec internal/lsp: fix query cmd usage
`query` usage has the following duplicated description.

```
Usage: query [flags] query [flags] <mode> <mode args>
```

```
$ gopls query
query: query must be supplied a mode
answer queries about go source code

Usage: query [flags] query [flags] <mode> <mode args>

The mode argument determines the query to perform:
  definition : show declaration of selected identifier

query flags are:
  -emulate string
        compatibility mode, causes gopls to emulate another tool.
        values depend on the operation being performed
  -json
        emit output in JSON format
```

Change-Id: Ib511b6c77d8b6dc8148ca46f88a1a133d21ba25c
GitHub-Last-Rev: a022377913fec65482a26e61a2b22927de7d4132
GitHub-Pull-Request: golang/tools#85
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173098
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-22 18:06:03 +00:00
Ian Cottrell
7f54bd5c70 internal/lsp: extract the common test logic
Change-Id: I0a3e8a2837cdeefb3dbbe7b86ed75a32b321797e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172778
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-22 16:50:02 +00:00
Rebecca Stambler
9eb0fb1732 internal/lsp: support comments on hover for typenames, funcs, fields
This change adds support for showing documentation when hovering over any
named type or function. For now, we show the entire comment associated
with the type; in future CLs, we should refine our approach and perhaps
only show the first line or sentence.

Updates golang/go#29151

Change-Id: Ib33284747b19acba67d79fb55c916574c3dd8073
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172958
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-22 16:38:38 +00:00
Muir Manders
aa740d4807 internal/lsp: handle embedded struct pointer definitions
When jumping to definition of an embedded struct pointer, be sure to
unwrap the pointer type so you properly jump to the pointee type.

Also, fix jumping to definition of an embedded struct inside an
anonymous struct inside a struct. The embedded struct detection was
continuing too far and thinking it wasn't an embedded struct when it
saw the anonymous struct.

Fixes golang/go#31451

Change-Id: I96017764270712a2ae02a85306605495075d12e7
GitHub-Last-Rev: 9997f60855ebe37bcca2fecc1ba2a7b871f393d4
GitHub-Pull-Request: golang/tools#83
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172583
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-20 18:18:00 +00:00
Than McIntosh
685fecacd0 go/internal/gccgoimporter: update package to match std lib version
Import changes from std lib version, specifically

  https://golang.org/cl/172603
  https://golang.org/cl/165739

which contain to a fix for reading of import data as
well as a couple of new test cases.

Updates golang/go#31540.

Change-Id: Iecb1a5a5a7bf100b2ebb871196868e96b1a50611
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173037
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-20 00:05:08 +00:00
Rebecca Stambler
c39e7748f6 internal/lsp: add type to placeholders in completion parameters
Fixes golang/go#31547

Change-Id: Ib6e54ae17c778421a49f34d3c60d56b126419a91
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172666
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-19 19:58:23 +00:00
Rebecca Stambler
f939817187 internal/lsp: add an additional check to ToUTF16Column
This change will at least stop the panic from occurring.

Updates golang/go#31341

Change-Id: I6b06941cfb6c020d2b37813573cb0dc068d54e65
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172667
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-19 19:37:30 +00:00
Rebecca Stambler
4796d4bd3d internal/lsp: use ast.Nodes for hover information
This change associates an ast.Node for some object declarations.
In this case, we only handle type declarations, but future changes will
support other objects as well. This is the first step in adding
documentation on hover.

Updates golang/go#29151

Change-Id: I39ddccf4130ee3b106725286375cd74bc51bcd38
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172661
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-18 23:52:43 +00:00
Rebecca Stambler
6732636ccd internal/lsp: use strings.EqualFold instead of ==
Change-Id: I34dc519f25fa976a959a749d4e1a525f5480b963
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172664
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-18 15:28:51 +00:00
Rebecca Stambler
a5870b4038 internal/lsp/protocol: add a compare function for span.URI
Add an additional check to handle URI comparisons. This fixes Hover on
Windows.

Change-Id: Ibfc816f1ec374144377a873c5b52867fafa3d7e8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172659
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-17 22:30:02 +00:00
Ian Cottrell
183b688ac4 internal/lsp: add compare functions for spans
Needed in order to sort lists of spans for stable tests, also used for span
equality tests.

Change-Id: Id2bedff4d7136494e2302c02bcb9bdc662ccfeb1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172660
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-17 22:21:04 +00:00
Rebecca Stambler
f6abc2cac8 internal/lsp: check content format instead of assuming markdown
Fixes golang/go#31078

Change-Id: I2227f64d839d65d7b46d43e1b90f5b1dc298bf6f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172601
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-17 21:38:10 +00:00
Ian Cottrell
afc68fbc60 internal/lsp: a cleaner way of doing overlays
Change-Id: I3ee053cfc4b63f54b9bf43d0ce6a2bae713e3a0d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172638
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-17 21:35:05 +00:00
Rebecca Stambler
780da32332 internal/lsp: trigger signature help after completing a function
Change-Id: Ib0ee79a11dd828c77bdf22a19a24ed9d883d8393
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172600
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-17 21:12:31 +00:00
Rebecca Stambler
34437f544f internal/lsp: refactor server.go to separate into LSP categories
This change separates the different behaviors of server.go by the
categories defined in the spec. This allows us to differentiate more
easily between the language features and the text synchronization code.

I also renamed the "Symbols" function to "Symbol", which fits with the
specification
(https://microsoft.github.io/language-server-protocol/specification#workspace_symbol),
and makes clearer the distinction between DocumentSymbols and Symbol.

Change-Id: I926b8a772c478f6ae426352fb12dc4403f0e736a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172637
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-17 20:54:51 +00:00
Rebecca Stambler
6149f385e4 internal/lsp: reply to shutdown request
Fixes golang/go#31333

Change-Id: I5cb40baee49c4b1644df5612c977ab1d71942022
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172639
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-17 20:25:44 +00:00
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
Ian Cottrell
7b3e515a8c internal/lsp: switch completion item tests to using the enum strings
Also change the enum values to match the prior string conversion routine.

Change-Id: I23ac6a72c8e116c5ee05e9324356481e519781e9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172410
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-17 17:57:43 +00:00
Rebecca Stambler
aa385af2d9 go/packages: add support for entire packages defined in overlays
This change adds support in go/packages for defining an entire package
in an overlay. We also add corresponding tests for this in gopls, to
confirm that it works as expected.

Fixes golang/go#31467

Change-Id: Iead203ab2964a7ac4f571be97624b725ac5de7e0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172409
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-17 17:55:51 +00:00
Ian Cottrell
4ca4b55e20 internal/lsp: make the symbols tests use the enum names rather than hard coding the values
this makes them less fragile, more portable and also more understandable.

Change-Id: Ife8a7ed76b7517eaae37bd3896fee87740ffb22a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172405
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-17 00:57:54 +00:00
Ian Cottrell
35716ff3bc internal/lsp: set the diagnostic source earlier
We now set the diagnostic source in the diagnostics call rather than when
converting it to the LSP protocol.

Change-Id: Ic762aaab1b2bf93b75c4c3d78aa84e2f918398fc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172408
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-17 00:57:43 +00:00
Ian Cottrell
49a1609436 internal/lsp: cleanup the diagnostic and completion tests
this make the same kinds of changes I already made to the symbol tests,
to make the messages more detailed and remove the goto

Change-Id: I7cb27839b2ab696ad4e3d6537d91152e34fb1d89
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172477
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-17 00:57:32 +00:00
Rebecca Stambler
dd61c98fae internal/lsp: run source.organizeImports on all codeActions
This change addresses the additional information we received in
https://github.com/Microsoft/language-server-protocol/issues/726.

Fixes golang/go#31359

Change-Id: Ied7c97ac1f9e429e28cc44563b93acabd80921a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172406
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-16 21:54:00 +00:00
Ian Cottrell
e2848a0e7d internal/lsp: minor clean up of symbol tests
remove the goto and make it print more information about why the failed.

Change-Id: I2f5f3c7fe88eae6fe5de61c5d9b401797b6933b2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172404
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-16 21:24:14 +00:00
Ian Cottrell
e528388d46 internal/lsp: Add to and from string handling for the enums
This is to help with debugging, and to allow us to write tests that do not
rely on hard coded constants.

Change-Id: Ica9ed5eee3d35539fe50d76276988852e62b81ca
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172401
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-16 21:24:01 +00:00
Rebecca Stambler
f6a9ef9393 go/packages: fix broken test that checks errors
Change-Id: Id9b1dc5e01a5b7eeca45448be0b7d7eef79fa928
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172400
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-16 21:09:21 +00:00
Rebecca Stambler
76038274be internal/lsp: fix badly formatted error messages from go vet
Fixes golang/go#31494

Change-Id: Id65e0daaa67a9fe955b7586af82e4433762cd56c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172398
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-16 19:41:54 +00:00
Rebecca Stambler
b8fc0e1722 internal/lsp: organize imports as a quickfix
This change adds the ability to organize all imports as quickfix on a
diagnostic, in addition to the standard "source.organizeImports" code
action kind. This change still requires a bit of work, since really, we
should only add one import per diagnostic and each edit should be the
edits necessary for the addition or removal of the individual import,
but this is a good start.

Change-Id: I57679446bec833d215c35533240102fb61c86f20
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172397
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-16 19:07:07 +00:00
Rebecca Stambler
52f869c107 go/gcexportdata: fix example test for changes in net/rpc
Apparently this frozen package is not so frozen. A change in the imports
has changed the line numbers, causing the test to break. Switch to
another test case in the hopes that it is less fragile.

Change-Id: I8d5203417b8bd73a9e837060d40980a09a767869
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172285
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2019-04-16 18:06:57 +00:00
Rebecca Stambler
3e7148b2fa internal/lsp: log errors when diagnostics fail
This will allow us to better track the errors that might cause golang/go#30786.

Change-Id: I310ad0fd0eda3102d5763e28fc383a4994ef0ff3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172280
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-16 17:15:26 +00:00
Ian Cottrell
9c9e1878f4 internal/lsp: fix crash when there is a type alias to a struct in the symbols code
Change-Id: If492a88c9f80003d7102b4f517621e52cc15759f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171861
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-16 15:17:39 +00:00
Rebecca Stambler
2e9de471eb internal/lsp: handle definitions for variables with error types
Fixes golang/go#31465

Change-Id: I2f79fe2167bab79b497125995efc938f2b63d274
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172117
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-15 20:59:51 +00:00
Ian Cottrell
744a51dd88 internal/lsp: normalise and make public diff<->edit conversions
This allows us to use the diff.ApplyEdits in tests, saving us from a different
implementation.
It also prepares for command lines that need to use diff features based on the
results of a protocol message.

Splitting content into lines is too easy to get wrong, and needs to be done
correctly or the diff results make no sense. This adds the SplitLines function
to the diff pacakge to do it right and then uses it everwhere we we already
doing it wrong.

It also makes all the diff tests external black box tests.

Change-Id: I698227d5769a2bfbfd22a64ea42906b1df9268d9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171027
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-15 20:31:36 +00:00
Ian Cottrell
fa491999fb internal/lsp: add unified diff
This adds unified diff handling to the diff package.
It also adds a lot more testing and also verifies the unified
diff tests against the diff program if you run the tests with
the flag -verify-diff
This functionality is needed for some of the command verbs.

Change-Id: I817438fd25c0b16f3f31578f51a886944e74a948
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171024
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-15 20:14:25 +00:00
Ian Cottrell
2b5498619e internal/lsp: Remove 1.10 compatability in tests
Change-Id: I6e136d8b3292c1bedfdbb294c0465689ad1ffafb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171239
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-15 15:47:27 +00:00
LE Manh Cuong
681f9ce8ac cmd/compilebench: update document
Add document for "-go" and "-short" flag, which are listed in output of
"compilebench help".

Also reformat "-pkg" document to align with the rest.

Change-Id: I8ce80d8e02a9cf2b94aa099aa34e53412210d61b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170237
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2019-04-11 18:01:16 +00:00
Zac Bergquist
2538eef759 internal/lsp: enhance document symbols support
Make methods children of their receiver's type symbol.
Add struct fields as children of the struct's type symbol.
Also identify numeric, boolean, and string types.

Updates golang/go#30915
Fixes golang/go#31202

Change-Id: I33c4ea7b953e981ea1e858505b77c7a3ba6ee399
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170198
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-10 21:12:19 +00:00
Jonathan Amsterdam
db7bebf5ae apidiff: fix old reference to golang.org/x/exp
Change-Id: I46027c584758a37bee51f1a514b1bee292c1514a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171437
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-04-10 19:41:13 +00:00
Tobias Klauser
7e5bf9270d cmd/getgo: fix build on aix
Change-Id: Ic4a2f8f32258b14354658af5a09c736404d38808
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170961
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-10 13:57:22 +00:00
Rebecca Stambler
96f2e7ef86 internal/lsp: ignore errors for completion and signature help
This change makes sure that we never return error messages for
completions and signature help requests - just empty results.

Change-Id: I00d75cd116daab63beb07f2344e47aac01bb64ee
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170958
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-09 22:37:05 +00:00