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

3482 Commits

Author SHA1 Message Date
Rebecca Stambler
c81b74871b go/packages, internal/lsp: modify tests to expose overlays bug
https://golang.org/issue/33157 explains the issues with overlays. The
gopls tests caught this bug, but the go/packages tests didn't, so modify
the go/packages tests correspondingly.

Change-Id: I8ea8e06e145aa2420655cbe4884e60f36acfad7b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186299
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-18 19:31:13 +00:00
Ian Cottrell
7caf8110c9 internal/lsp: purge the remains of the xlog system now it is not used
Change-Id: Iad8f037de88c2657734b8a1b5c73fc708d3b5924
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186198
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-18 19:11:56 +00:00
Ian Cottrell
73497f0562 internal/lsp: convert logging calls
Change-Id: I09ee44d0121b7ced001b8195f9fa81b5225cb0c7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186197
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-18 19:03:12 +00:00
Ian Cottrell
7ec096a112 internal/lsp: add a new telemetry based logging system
Also add enough support that using it from within the context of the lsp will
report back to the original client.

Change-Id: I081f157c289642454e9f0476747b2131dcd4e16c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185996
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-18 19:02:45 +00:00
Ian Cottrell
f2838559cb internal/lsp: use a background context for the background worker
A detatched context ends up attributing all background work to the initialize
function.

Change-Id: I81206462752228d5ac81408fb1e3fb86ab36796e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186457
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-18 19:01:55 +00:00
Ian Cottrell
128ec6dfca internal/lsp: fixed broken tracing
I dropped the line that added the stats to the context when merging the recent changes.

Change-Id: I66ab2958b0737360896b40bf30c5ca3c2cebbae5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186300
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-17 19:45:35 +00:00
Rebecca Stambler
e98af23098 go/packages: add debug logging via the packages.Config
This change adds a Logf field to the packages.Config.

Change-Id: I144a9a1e1181585bbe621898c4a3e6a007a38322
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185993
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-07-16 22:11:50 +00:00
Suzy Mueller
fdb8f0bb4e internal/lsp: cache the imports ProcessEnv across imports calls
The imports ProcessEnv contains cached module and filesystem state. This change
allows gopls to use the same ProcessEnv and resolver across multiple calls to the
internal/imports library.

A ProcessEnv belongs to a view, because the cached module state depends
on the module that is open in the workspace.

Since we do not yet track whether the 'go.mod' file has changed, we
conservatively reset the cached state in the module resolver before
every call to imports.Process.

Change-Id: I27c8e212cb0b477ff425d5ed98a544b27b7d92ee
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184921
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-16 21:50:18 +00:00
Ian Cottrell
b0712d6011 internal/lsp: fix the incomplete and broken commit
https://go-review.googlesource.com/c/tools/+/186297 was the wrong commit, this
adds the changes that were supposed to be part of it.

Change-Id: I0c4783195c2670f89c3213dce2511d98f21f1cf4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186379
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-16 20:34:22 +00:00
Rebecca Stambler
b667c4c58e internal/lsp: cache the *ast.File and *token.File on the package
This change removes the need for the ast and token fields on the *goFile
object. We switch to using source.ParseGoHandles on the package, which
means that we can easily access both the AST and token via the package,
which is already cached.

Change-Id: I5f78bbe09362f4d95eb15556617bdbd809a7a55d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185878
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-16 19:44:59 +00:00
Ian Cottrell
502543d2ed internal/jsonrpc2: move stats and logging across to gopls
Change-Id: I718ad6075028e922a1a046b22fd01a1315421be1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186297
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-16 19:44:06 +00:00
Ian Cottrell
0b5a7f81db internal/lsp: add tracing to the didOpen call
We only had the tracing on didChange before this

Change-Id: Iadec8a43d439931bf58925f149a1d32b3ae29c36
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186199
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-16 17:52:09 +00:00
Rebecca Stambler
919acb9f1f internal/lsp: add continue to source_test
Noticed this because I was accidentally running these tests with Go
1.11.

Change-Id: Ic35d71bd1da9078b4bde6aa2ed62d54a8b95b0e0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186298
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
2019-07-16 15:00:14 +00:00
Jean de Klerk
fefcef05ab digraph: refactor allpaths to print an adjacency list
Refactors allpaths to print an adjacency list from "from" to "to", instead of
just the nodes. This allows other tools like modgraphviz to print the subgraph.
For example, the following command:

    cd $GOPATH/src/cloud.google.com/go && \
    go mod graph | \
    digraph allpaths cloud.google.com/go golang.org/x/text@v0.3.2 | \
    modgraphviz | \
    dot -Tpng -o graph.png

Generates the following graph.png: https://user-images.githubusercontent.com/3584893/60481727-df0a8680-9c4b-11e9-8df9-c581d599edd1.png

Also splits out the allpaths tests into their own test, and adds many test
cases.

This is a breaking change. The previous behavior returned vertices; now it
returns edges. If you relied on the previous behavior, use:

    my-application | digraph allpaths <from> <to> | digraph nodes

Change-Id: I2eb7c377f5fe1e1e90c5b74eaa78d5211192bb2a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184337
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-07-16 02:13:16 +00:00
Ian Cottrell
9b2cb0e5f6 internal/lsp: add temporary file to fix bug with tip go
There is a problem with this test failing in module mode only with the
tip of the go tree. Adding this file changes it from a pure overlay package
to one that has an extra file, which fixes it for now.

updates golang/go#33125

Change-Id: I87dae0b44691246a1f79df454afb190f944cc886
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186259
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-15 22:19:14 +00:00
Suzy Mueller
a0f5e6c5c2 internal/lsp: sort rename results
We recommend that gopls integrators apply the []TextEdit responses in
reverse order to get a correct resulting document. This strategy works
when the response is already sorted. Have gopls return sorted []TextEdit
for each file.

Fixes golang/go#33123

Change-Id: Ib570881c9623695d2ae3194fa8a97b0a681a3250
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186258
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-15 22:13:26 +00:00
Michael Matloob
9e48ab1d90 go/loader: normalize cycle to remove flake
Fixes golang/go#31279

Change-Id: Idd1eead3b1e9a90ba39d04019ef32200deb4c983
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185984
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-15 17:29:21 +00:00
Rebecca Stambler
607ca053a1 internal/lsp: fix panics in loading, add more logging
Fixes golang/go#32929

Change-Id: I15e258fe03ef07dbb4ece79f52cb0d0353c8b0b1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185994
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-15 04:47:52 +00:00
Ian Cottrell
ef8e083144 internal/lsp: add an rpc summary debug page using the metrics
Change-Id: I92481b0e7996747d70081d575a47768222219506
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185986
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-15 03:47:58 +00:00
Ian Cottrell
565492930f internal/lsp: remove the non context xlog path
And purge the loggers from the view and session.

Change-Id: I262958f340e9a5ac9cc9b3db9e9910381e457478
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185989
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-15 03:45:47 +00:00
Ian Cottrell
1b7e409d2c internal/lsp: convert all logging calls to the context version
Change-Id: I20e3acee4272f05a9f31a7bb4219fc2fe751e6b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185988
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-15 03:44:59 +00:00
Ian Cottrell
c8ecc7589e interal/lsp: add context based version of xlog
this is a temporary migration solution

Change-Id: Idb6542298dff85a0926aae761f6317ea155293db
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185987
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-15 03:44:47 +00:00
Ian Cottrell
8b927904ee internal/jsonrpc2: extract logic to handler hooks
Change-Id: Ief531e4b68fcb0dbc71e263c185fb285a9042479
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185983
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-12 21:32:46 +00:00
Ian Cottrell
b32ec66a23 internal/jsonrpc2: cleanup the jsonrpc2 callbacks
We merge them into a single interface and support multiple of them rather than
just one.
This will allow us to stack handlers with different responsabilities and extract
some core logic (like tracing) out to a handler where it belongs.

Change-Id: I6aab92138550c5062fcb1bed86171e0850d1eb38
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185879
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-12 21:23:00 +00:00
litleleprikon
f4b4e63240 internal/lsp: fix unnecessary error logging
In internal/lsp/link.go appeared a bug that error message is printed
even if error is not apeared. this commit is fixing this behaviour.

Fixes golang/go#33087

Change-Id: I932546867d78c5c0c3d2c9dabd13287f6837f458
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186037
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-07-12 19:52:12 +00:00
Rebecca Stambler
128c804424 internal/lsp: handle language ID in didOpen calls
This change merely modifies session.DidOpen to accept the document's
language ID. It does not actually add any handling of the language ID.

Change-Id: I2582ae307d1ca062f37b4683907cdbcfdfc61809
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184160
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-12 19:25:23 +00:00
litleleprikon
8308f91286 internal/lsp: add links search in comments and string literals
Add to "textDocument/documentLink" request handler ability to search
URLs in string literals and comments.

Fixes golang/go#32339

Change-Id: Ic67ad7bd94feba0bb67ab090a8903e30b2dff996
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185219
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-12 18:53:41 +00:00
Muir Manders
63f37bb4d3 internal/lsp: fix some cases of stuck files
If typeCheck() returned an error, we could get into a state where a
package had an entry in the pcache, but the package's files had an
empty "pkgs" map. When we got a DidChange event for one of the files,
no packages would get invalidated since the file's "pkgs" was
empty. This resulted in the cached typeCheck() error persisting
indefinitely. Fix by never caching pcache entries on error.

An easy way to reproduce the problem was to delete the package name
from a file. For example, edit "package foo" to be just
"package". This caused the package to get stuck with an "AST for %s
has an invalid position" error.

Change-Id: I330bf9e419852dffa0f2dee94b56226367488dd1
GitHub-Last-Rev: 18be7078521b942694c76f799a2d520eee47167d
GitHub-Pull-Request: golang/tools#135
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185839
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-07-12 18:43:07 +00:00
Michael Matloob
d5f455491e go/analysis: update internal/facts and unit checker to support all(Package|Object)Facts methods
Change-Id: Ibae7a87417be49941a5e4970c25df2ff48b346a7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185978
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-12 16:23:23 +00:00
Ian Cottrell
9a621aea19 internal/lsp: update the generated lsp protocol
Change-Id: Ic30a6e9e49a67f93419547ea2c61d87109959393
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185777
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-11 19:11:10 +00:00
Ian Cottrell
9c57229d8a internal/lsp: add prometheus exporting of all metrics
Change-Id: I1e7ce371d8abd2eb80aad70935695f61b6374ff8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185347
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-11 17:26:14 +00:00
Ian Cottrell
75aaabac35 internal/lsp: reduce trace package to minimal StartSpan for now
also change the return type to be and end function and not an incomplete span

Change-Id: Icd99d93ac98a0f8088f33e905cf1ee3fe410c024
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185349
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-11 17:25:55 +00:00
Ian Cottrell
6156d14a7a internal/lsp: add the metrics package
This provides the basic support for aggregating stats into useful metrics,
utilizing tags.
This change also adds the standard rpc metrics for the stats the jsonrpc2 system
is already filling in.

Change-Id: Ibe1b64c4c4c587dacd53112454606634e9f682ce
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185342
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-11 17:12:21 +00:00
Henry Wong
01b81f4f93 internal/lsp: support hover for *ast.ImportSpec
Since 'IdentifierInfo' doesn't contain ast node of import spec,
gopls will construct an empty string under plaintext mode and
'```go\n\n```' under markdown mode for *ast.ImportSpec. For now,
the hovering result of import spec is the corresponding node
format.

Fixes golang/go#33000

Change-Id: I4c25782ddb5bcc557ace82f46d480316b0b90509
GitHub-Last-Rev: 150728f401c5f9b161b557584ad3250f46e50869
GitHub-Pull-Request: golang/tools#134
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185357
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-11 17:06:56 +00:00
Ian Cottrell
5f9351755f internal/lsp: stop making background contexts everywhere
For all uses inside the lsp we use the detatch logic instead
For tests we build it in the test harness instead
This is in preparation for things on the context becomming important

Change-Id: I7e6910e0d3581b82abbeeb09f9c22a99efb73142
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185677
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-11 16:38:52 +00:00
Jean de Klerk
2868181328 digraph: clean up docs, usage, copyright
- Move verbose usage docs to godoc, replace usage with terse description of
usage and commands.
- Add copyrights.
- Update usage to more canonical function format instead of const format.

Change-Id: I30d072f391bbf9911798e90efb85cd5351d99205
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184177
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-07-10 18:46:09 +00:00
Rebecca Stambler
554846603d internal/lsp: update version and go.mod
Change-Id: I637085b8866d561b9ac21a6612b3bdad8cf6c99a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185557
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-10 16:59:51 +00:00
Rebecca Stambler
831012c29e internal/lsp/debug: increase gopls version before tagging new version
Change-Id: I4273faa26e23dd237078c02439c1bafa2904fcc5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185348
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-10 15:33:21 +00:00
Suzy Mueller
7b25e351ac internal/lsp: rename identifiers in test packages
Support renaming of identifiers in test packages. The packages for
all of the references must be checked and the changes need to be
deduped, since both a package and its test package contain some of the
same files.

Fixes golang/go#32974

Change-Id: Ie51e19716faae77ce7e5254eeb3956faa42c2a09
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185277
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-09 21:17:00 +00:00
Ian Cottrell
f82b303b69 internal/lsp: add new stats library
This is the basic library that allows for recording of stats about the program
operation.

Change-Id: I09f7e3de5fc37aaf29bc0db46f15b15056fc0eb2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185338
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-09 19:46:23 +00:00
Ian Cottrell
75a6f91e26 internal/lsp: add the new form of the telemetry tagging package
This maps more directly to the basic telementery tagging requirements and uses
the context package in a way that is more idomatic.

Change-Id: If08c429b897bddfe014224ac2d92d7796a521ab9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184941
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-09 19:46:06 +00:00
Ian Cottrell
8962968d5a internal/lsp: add the worker package
This is used by all the telemetry packages that come next

Change-Id: Ic84d91da2a792b53ee8839aae207ae5767ab17e0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184940
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-09 19:45:51 +00:00
Rebecca Stambler
4f9eeaf1bf internal/lsp: add documentation to completion items
This change adds documentation to the completion items. This normally
should be done in completionItem/resolve, since it takes more time to
compute documentation. However, I am not sure if that latency incurred
by pre-computing documentation is actually significantly more than the
latency incurred by an extra call to 'completionItem/resolve'. This
needs to be investigated, so we begin by just precomputing all of the
documentation for each item.

Updates golang/go#29151

Change-Id: I148664d271cf3f1d089c1a871901e3ee404ffbe8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184721
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-07-09 19:19:00 +00:00
Suzy Mueller
e491332ed8 internal/lsp: compare names when finding references
Objects for builtin types all have position token.NoPos. We do
not want all objects that have position token.NoPos to be matched
when we are looking for references for this object, so we need to
compare the names of the objects as well.

Fixes golang/go#32991

Change-Id: I67e7aba9909ebcbb246203ea5c572debf996c792
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185247
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-09 18:45:27 +00:00
Muir Manders
d255de4fdb internal/lsp: don't refresh metadata when context canceled
We err on the side of refreshing package metadata if something goes
wrong getting a file's AST, but we don't want to refresh in the case
of context cancellation. Now we check for that error explicitly.

In particular, I noticed that completions would stop working when
typing quickly. Refreshing the metadata triggers "go list" calls which
can take a long time in certain cases.

Change-Id: I1b0c580e5541b1536a69ccaef241d7e8c5720d60
GitHub-Last-Rev: 6a82bfb586f93ef5e8e5996b11e06ffc7808f529
GitHub-Pull-Request: golang/tools#130
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184977
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-09 18:24:20 +00:00
Suzy Mueller
07655f7ec7 internal/lsp: return an error when renaming a builtin
Return an error when attempting to rename a builtin identifier.

Fixes golang/go#32992

Change-Id: I7fb0f9cc9499e5afdfb14805c49c820e4da3b601
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185246
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-09 18:23:51 +00:00
Michael Matloob
c8855242db go/packages: add documentation on the driver protocol.
This adds a comment in go/packages/external.go that specifies what the
driver protocol is.

Change-Id: Ie0c272a84cd34ba80f80f68b328463d8ddd07189
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184943
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-08 20:34:11 +00:00
Suzy Mueller
c93f28baaa internal/lsp: check no errs for assignability rename
The satisfy package has a precondition for Finder.Find that requires
that the package has no type errors. If this is a check that we would
perform, give an error and do not rename.

Fixes golang/go#32882

Change-Id: Id44b451bf86ff883fd78a6306f2b2565ad3bdeb9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184857
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-07-08 20:09:55 +00:00
Henry Wong
dd7c7173f1 internal/lsp: remove the unused function 'markupContent'.
The last usage of 'markupContent' has been deleted in
https://go-review.googlesource.com/c/tools/+/172958.

Change-Id: I03296fa93069427339f17c7b2ad2267030a5b99b
GitHub-Last-Rev: a85b88cdfd00c8d1edf4fdad6302486379beae9a
GitHub-Pull-Request: golang/tools#132
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185237
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-07-08 17:12:32 +00:00
Paul Jolly
60762fc531 internal/lsp: fix test failure introduced in CL 185058
Failed to properly check the try-bot result in CL 185058. Hence didn't
spot the LSP tests that also verify offset behaviour. This CL fixes
those tests to align the LSP tests with the change introduced in CL
185058.

Change-Id: Ia81ab6db7a2c3a4729d8ef73205b6071af270b00
Reviewed-on: https://go-review.googlesource.com/c/tools/+/185220
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-08 15:18:58 +00:00