1
0
mirror of https://github.com/golang/go synced 2024-09-30 12:28:35 -06:00
Commit Graph

159 Commits

Author SHA1 Message Date
Ian Cottrell
7504fd2219 internal/lsp: fix broken lsp logs
ID's are now by value not pointer, which caused it to not use the Format
method, resulting in broken id strings
The id maps need to be crossover (set and get go to different maps for a given direction of message)

Change-Id: Ide2b63ec1b009ae3587ee10e8bce018732ea342c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/229244
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
2020-04-21 17:00:05 +00:00
Ian Cottrell
2dc4334630 internal/jsonrpc2: rewrite streams in terms of messages
messages are the atomic unit of communication, changing streams
to read and write whole messages makes the code clearer.
It also avoids the confusion about what should be an atomic
operation or when a stream should flush.

Change-Id: I4b731c9518ad7c2be92fc92211c33f32d809f38b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/228722
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-04-21 13:42:58 +00:00
Ian Cottrell
ca8a290ca5 gopls: convert replay to use the new message types
this save it from having to understand the json wire format.

Change-Id: I4261cb53a4d5fe2263d7d73ebf9e96e6be2e54a1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/228720
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
2020-04-20 21:06:04 +00:00
Dominik Honnef
332987a829 gopls/internal/hooks: don't run staticcheck's SA5011
SA5011 relies on facts from dependencies to avoid false positives.
However, gopls currently only loads export data for dependencies, it
does not compute facts.

SA5011 is unlike other analyzers in staticcheck, which may produce
false negatives if facts are missing, but no false positives.

Change-Id: I5063b701bbedca7b09d1894997f8c574fa497939
Reviewed-on: https://go-review.googlesource.com/c/tools/+/228119
Run-TryBot: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-14 03:22:29 +00:00
Ian Cottrell
b854406a88 internal/jsonrpc2: make the wire structures private
The wire structures do not need to be public, and making them so might make it
harder to keep the package correct without breaking changes if the protocol
changes in the future.

Change-Id: I03a5618c63c9f7691183d4285f88a177ccdd3b35
Reviewed-on: https://go-review.googlesource.com/c/tools/+/227838
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-04-13 01:57:29 +00:00
Ellison Leão
cd5a53e07f gopls/docs: adding nvim-lsp option in gopls README file
Change-Id: Ic44210e227559c8e1cd5cf1350cde69e2817f5e3
GitHub-Last-Rev: c020218392160d03a9448eda62e098fe0c91a063
GitHub-Pull-Request: golang/tools#221
Reviewed-on: https://go-review.googlesource.com/c/tools/+/227442
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-04-07 19:18:07 +00:00
Rebecca Stambler
3304cfb00f internal/lsp: temporarily disable type error analyzers by default
If we release gopls/v0.4.0 soon, we should keep these new analyzers off
by default. They were just merged, so they haven't been used enough to
be enabled, I think. We'll turn them on by default for gopls/v0.5.0.

Also, ended up creating a helper function to check if analysis has been
abled (which fixed a small bug in FindAnalysisError), and another helper
function to enable all analyses for testing purposes.

Updates golang/go#38212

Change-Id: I5ee94b3582dfc0863978650fc6ce51bfa0606c13
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226962
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rohan Challa <rohan@golang.org>
2020-04-02 16:54:32 +00:00
Rohan Challa
099440627f internal/lsp: add goreturns like functionality as quickfix
This change ports the functionality of https://github.com/sqs/goreturns
to be used as code actions on diagnostics that have missing
return values. It improves on the original goreturns functionality by:

- filling out empty return statements
- trying to match existing return values to the required return
  values and then filling in missing parameters

Fixes golang/go#37091

Change-Id: Ifaf9bf571c3bc3c61e672b0a2f725d8d734d432d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/224960
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-04-01 19:27:44 +00:00
Bryan C. Mills
ac2e956812 go.mod: upgrade goldmark dependency to fix js/wasm build
For golang/go#38183
Updates yuin/goldmark#120

Change-Id: I913c3409fe0c774209ce046a85699ef845e7c7b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226560
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-03-31 19:25:49 +00:00
Rebecca Stambler
a30bf2db82 gopls/integration/govim: revert back to using the latest govim
A new version of govim with the fix for the original issue has been
released.

Change-Id: Iaea2eff7387f352cae1657949c5e364a66337f68
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226557
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-31 02:57:13 +00:00
Rob Findley
046453f0ab gopls/integration/govim: fix govim tests without a go.mod file
govim tests without a go.mod file were accidentally picking up the
go.mod file from the build context at /workspace/go.mod.

To fix this, run govim tests in a new, dedicated artifacts volume
mounted at /artifacts.

Change-Id: Ie224bbb730741d047be26a6d057a023ddc8a3453
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226157
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-30 17:32:57 +00:00
Rohan Challa
eabff7e044 internal/lsp/analysis: add quickfix for "no new vars on left side"
This change adds a quick fix for type errors of the type "no new vars on left side of :=". It will replace the ":=" with an "=".

Updates golang/go#34644

Change-Id: I91af8eb82956104229c3b4f3d0fce60fdfdbb5ea
Reviewed-on: https://go-review.googlesource.com/c/tools/+/225477
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-27 19:15:53 +00:00
Rohan Challa
f4fcf867e7 internal/lsp/analysis: add quickfix for "no result values expected"
This change adds a quick fix for type errors of the type "no result values expected". It will replace the return statment with an empty return statement.

Updates golang/go#34644

Change-Id: I3885748dfc69a2d19f8e7a2e81f36f6d0a20d25b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223666
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-27 18:57:59 +00:00
Rob Findley
17a19b5fe7 internal/lsp/cmd: add a flag to disable telemetry
govim integration tests (and probably some real user sessions) are
broken because telemetry metrics are not threadsafe, resulting in an
index out of range panic.

Fix this by adding a flag (labeled temporary) to disable telemetry
export.

Also temporarily update govim to master to pick up some fixes, and run
only the -short tests to avoid timeouts.

Updates golang/go#38042

Change-Id: I584e5d200c2f732bd4024002ee6253d09623b29f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226057
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2020-03-27 18:51:17 +00:00
Rohan Challa
8f81e2e6d4 internal/lsp/analysis: add quickfix for undeclared variable
This change adds a quick fix for diagnostics that have an error message of the form "undeclared name: %s". It provides a quick fix to add a new variable with that name.

Updates golang/go#34644

Change-Id: I6534ee79d1770d1a62bac169c3c7e52e2443f39e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222237
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-27 18:31:06 +00:00
Rohan Challa
42235f6384 internal/lsp: add support for type error analyzers
This change adds support within gopls for analyzers that work with type errors to provide suggested fixes.

Updates golang/go#34644

Change-Id: Ia8929173752fda6bd84a9edaabd310e758f25fe8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222761
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-27 17:27:16 +00:00
Rohan Challa
8db92c5f61 internal/lsp/hooks: enable staticcheck hooks
Forgot to enable the staticcheck hooks when I created a struct for analyzers inside of the lsp (https://go-review.googlesource.com/c/tools/+/223662).

Change-Id: Ice7798089100107113741caed3ddc41d172830b4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/225837
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-27 16:43:12 +00:00
Rohan Challa
5d86d385bf internal/lsp/analysis: add simplify-slice pass from "gofmt -s"
This is one of the simplifications that "gofmt -s" applies.
https://golang.org/cmd/gofmt/#hdr-The_simplify_command

A slice expression of the form:
	s[a:len(s)]
will be simplified to:
	s[a:]

Updates golang/go#37221

Change-Id: Ibd4dedaadc9b129d5d39524f0c1ccc8a95bf7e0d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223659
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-03-26 21:04:57 +00:00
Rohan Challa
e428a8eca3 internal/lsp/analysis: add simplify-composite-lit pass from "gofmt -s"
This is one of the simplifications that "gofmt -s" applies.
https://golang.org/cmd/gofmt/#hdr-The_simplify_command

An array, slice, or map composite literal of the form:
	[]T{T{}, T{}}
will be simplified to:
	[]T{{}, {}}

Updates golang/go#37221

Change-Id: I2dca46501983c8af3581c9319d973da5cf690388
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223660
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-03-26 20:50:12 +00:00
Rohan Challa
88b9c284fd internal/lsp/analysis: add pass for unused parameters
This change adds a pass that checks for unused parameters inside of a function. It is disabled by default.

Updates golang/go#36602

Change-Id: I9e8de3368f16f27e7816ec4ddb16935e1a05584e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222817
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-26 20:36:28 +00:00
Rohan Challa
94fe02cb5c internal/lsp/analysis: add simplify-range pass from "gofmt -s"
This is one of the simplifications that "gofmt -s" applies.
https://golang.org/cmd/gofmt/#hdr-The_simplify_command

A range of the form:
	for x, _ = range v {...}
will be simplified to:
	for x = range v {...}

A range of the form:
	for _ = range v {...}
will be simplified to:
	for range v {...}

Updates golang/go#37221

Change-Id: Ic6babbd0b8ab961ebb4d0d6df72df52d9acde6e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223661
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-26 20:18:45 +00:00
Rohan Challa
02a6ca6dc3 internal/lsp: change disabledAnalyses setting to be general
This change removes the disabledAnalyses setting and replaces it with a more general feature named "analyses". This will allow users to opt in as well as opt out of analyzers that they do not find useful. This also updates some documentation to show users what analyzers gopls is using and which are enabled by default.

Change-Id: Id3239b4c4c9667e834f262c889270d14fdba0f93
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223662
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-26 19:30:34 +00:00
Rob Findley
4c1ea0558e gopls/integration/govim: improvements/fixes for run_local.sh
With the update to go1.14, run_local.sh runs into the ubuntu mlock
issue. Fix this by setting memlock=unlimited.

Also make it possible to run docker with sudo, and run -short tests.

Change-Id: I8c9e44cd16f0a2a0d77bf28133ad4f111058b5cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/225520
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-25 20:25:52 +00:00
Rebecca Stambler
c97a9db72c gopls/doc: add documentation for "local" configuration
Change-Id: I9181c986b8e5aa21526ff934b62c041f3c820b7c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/224117
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-03-19 20:59:51 +00:00
Rob Findley
9a0fabac01 internal/lsp: fix errors found by staticcheck
While experimenting with different static analysis on x/tools, I noticed
that there are many actionable diagnostics found by staticcheck. Fix the
ones that were not false positives.

Change-Id: I0b68cf1f636b57b557db879fad84fff9b7237a89
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222248
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-19 19:20:54 +00:00
Koichi Shiraishi
bd88ce9755 gopls: update github.com/sergi/go-diff to v1.1.0
Change-Id: I522b49dfe7e2437bbf76fa58baa66b29aee8e28a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223497
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-16 18:21:29 +00:00
Russ Cox
8ac058ed9f present: accept Markdown in present files
Markdown is enabled by starting the title with "# ".
See the new documentation in present/doc.go for details.

For golang/go#33955.

Change-Id: I04ef2aa2cf253bdf48910c5674d679a482ffa33f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222846
Reviewed-by: Rob Pike <r@golang.org>
2020-03-13 20:55:25 +00:00
Rob Findley
c312e98713 gopls/doc: update daemon.md and remove 'experimental' caveats
Now that the feature-set is relatively complete for running gopls in
daemon mode, daemon.md is updated to reflect the new features and to
remove some of the experimental warnings. Similarly the `-remote` flag
is made more welcoming.

The feature still needs more usage, but it shouldn't be considered
experimental anymore.

Fixes golang/go#34111

Change-Id: I994fc8f9f84bf856f24e1eadabd73c503267e804
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222717
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-03-12 19:44:00 +00:00
Rob Findley
30fd94b347 internal/lsp/lsprpc: expose configuration for auto-started daemon
Three new flags are added to the serve command, and threaded through to
the LSP forwarder:
 -remote.listen.timeout: -listen.timeout for the auto-started daemon
 -remote.debug: -debug for the auto-started daemon
 -remote.logfile: -logfile for the auto-started daemon

As part of this change, no longer enable debugging the daemon by
default.

Notably none of this configuration affects serving, so modifying this
configuration has been chosen not to change the path to the automatic
daemon. In other words, this configuration has effect only for the
forwarder process that starts the daemon: all others will connect to the
daemon and inherit whatever configuration it had at startup. This should
be OK, because in the common case this configuration should be static
across all clients (e.g., many Vim sessions all sharing the same
.vimrc).

Exposing this configuration made the signature of lsprpc.NewForwarder
a bit hard to understand, so I decided to go ahead and switch to a
variadic options pattern for initializing both the Forwarder and
StreamServer, the latter just for consistency with the Forwarder.

Updates golang/go#34111

Change-Id: Iefb71e337befe08b23e451477d19fd57e69f36c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222670
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-03-12 19:43:16 +00:00
Hana (Hyang-Ah) Kim
270c59dc40 gopls/integration/govim: update to go1.14 images
Change-Id: I24b6b20ca78867cc973ca0a96c388876f4f40c70
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222663
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-09 17:26:05 +00:00
Rohan Challa
136c3617b6 internal/lsp: support textDocument/formatting for .mod extension
This change implements support for textDocument/formatting when it comes to go.mod files. It also adds formatting on save ability.

To enable formatting on save for go.mod files, you need to include the following settings inside of your VSCode settings.json:

...
"[go.mod]": {
	"editor.codeActionsOnSave": {
		"source.organizeImports": true,
	},
	"editor.formatOnSave": true,
},
...

Updates golang/go#36501

Change-Id: I60ac14d0e99b2b086fe9a8581770771aafc2173c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221223
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-06 13:51:27 +00:00
Ian Cottrell
4183ba16a9 internal/lsp: move the debug.Instance onto the Context
This allows us to register a telemetry exporter that works with mulitple active
debug instances.
It also means we don't have to store the debug information in our other objects.

Change-Id: I9a9d5b0407c3352b6eaff80fb2c434ca33f4e397
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221558
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-03 22:54:53 +00:00
Rebecca Stambler
658b03bcd3 all: upgrade outdated dependencies
Used Rohan's new code lens feature to upgrade some of our outdated
dependencies.

Change-Id: Ifddd5c00f36e5a7e32aca3113e03cd3caeb4cdb9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221102
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-03-03 20:20:40 +00:00
Marwan Sulaiman
5c7c66ced5 gopls/doc: update godoc.org to pkg.go.dev
Now that it's the default link target.

Change-Id: Ic90700168711a16fc0c98f980c6d449ca1328669
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221498
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2020-02-28 13:56:38 +00:00
Rob Findley
706bc42d1f gopls/doc: add documentation for running gopls as a daemon
Some initial documentation is added describing how to use a shared gopls
daemon, following the work in golang.org/issues/34111.

Updates golang/go#34111

Change-Id: I8ee07d7415ae799bb867973c34bda53f9a35126d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221138
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-27 22:23:43 +00:00
Pontus Leitzler
042d10a150 gopls: update staticcheck to 2020.1.3
This change updates staticcheck to 2020.1.3.

It fixes two bugs involving //lint:ignore directives:

- When ignoring U1000 and checking a package that contains tests, Staticcheck would incorrectly complain that the linter directive didn't match any problems, even when it did.
- On repeated runs, the position information for a this linter directive didn't match anything report would either be missing, or be wildly incorrect.

Change-Id: I98bc57d290393d77af1ab8acf486239a8f125fac
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220597
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-25 18:52:58 +00:00
Jordan Christiansen
a6bebb6330 gopls/doc: Clear out fixed issues
I was checking on the status of the known issues, and I noticed that some are already fixed. I checked each one and culled the list.

Change-Id: I178cb5fdc3aa21e658c3ffd8bf558d5c48c5528f
GitHub-Last-Rev: b0135c2c6e95395026641ce8214f08a2aa623d92
GitHub-Pull-Request: golang/tools#211
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220681
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-24 23:14:51 +00:00
Rob Findley
20f46356b3 internal/lsp/lsprpc: add a handshake between forwarder and remote
In the ideal future, users will have one or more gopls instances, each
serving potentially many LSP clients. In order to have any hope of
navigating this web, clients and servers must know about eachother.

To allow for such an exchange of information, this CL adds an additional
handler layer to the serving configured in the lsprpc package. For now,
forwarders just use this layer to execute a handshake with the LSP
server, communicating the location of their logs and debug addresses.

Updates golang/go#34111

Change-Id: Ic7432062c01a8bbd52fb4a058a95bbf5dc26baa3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220081
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-24 22:51:04 +00:00
Rob Findley
e02f5847d1 internal/lsp/debug: move all debug state onto the Instance
For testability, and to support the exchange of debug information across
Forwarder and server, it is helpful to encapsulate all debug information
on the instance object.

This CL moves all state in the debug package into a new 'State' type,
that is added as a field on the debug.Instance. While doing so, common
functionality for object collections is factored out into the objset
helper type.

Also add two new debug object types: Client and Server. These aren't yet
used, but will be in a later CL (and frankly it was easier to leave them
in this CL than to more carefully rewrite history...).

Updates golang/go#34111

Change-Id: Ib809cd14cb957b41a9bcbd94a991f804531a76ea
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220078
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-24 22:50:47 +00:00
Pontus Leitzler
57f3fb51f5 gopls: update Staticcheck to 2020.1.2
This change updates Staticcheck to the newly released 2020.1.2.

Change-Id: I80606b9c993de2f504c0ca3ee68f695ec8bd50e9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220477
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-02-21 19:17:10 +00:00
Rob Findley
b320d3a0f5 internal/jsonrpc2/servertest: support both TCP and pipe connection
Update the servertest package to support connecting to a jsonrpc2 server
using either TCP or io.Pipes. The latter is provided so that regtests
can more accurately mimic the current gopls execution mode, where gopls
is run as a sidecar and communicated with via a pipe.

Updates golang/go#36879

Change-Id: I0e14ed0e628333ba2cc7b088009f1887fcaa82a5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/218777
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-16 19:22:41 +00:00
Heschi Kreinick
f7b8cc7bd0 internal/span,lsp: disambiguate URIs, DocumentURIs, and paths
Create a real type for protocol.DocumentURIs. Remove span.NewURI in
favor of path/URI-specific constructors. Remove span.Parse's ability to
parse URI-based spans, which appears to be totally unused.

As a consequence, we no longer mangle non-file URIs to start with
file://, and crash all over the place when one is opened.

Updates golang/go#33699.

Change-Id: Ic7347c9768e38002b4ad9c84471329d0af7d2e05
Reviewed-on: https://go-review.googlesource.com/c/tools/+/219482
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-02-14 22:51:03 +00:00
Rebecca Stambler
2ee7536ab1 internal/lsp: remove nilness analyzer
The nilness analyzer requires SSA, which is very expensive to build and
uses a lot of RAM. It also seems to really shoot up memory usage when it
hits certain cases, which is causing a lot of problems for users.
Disable this analysis - we'll leave SSA to staticcheck.

Updates golang/go#36639

Change-Id: I46e67a6fd7828a5fddcd42d1aa00876f17c79e3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/219203
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-12 21:32:43 +00:00
Rebecca Stambler
6822f1ada4 internal/lsp: disable nilness analyzer, unless staticcheck enabled
Users with staticcheck enabled will be more tolerant of increased RAM
usage. We might be able to disable this check entirely once the next
version of staticcheck is released with a similar analysis (https://staticcheck.io/docs/checks#SA5011).

Change-Id: I1a844cc226e34e0f62222f12912797a6cc9d06e2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/219018
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-11 20:49:38 +00:00
Christopher Loessl
533eb26545 fix(readme): expected comma
Change-Id: I821783f364bcbc527ba4942d63c0aeb9ca473862
GitHub-Last-Rev: b0ac31a12214825f9ee8efd643d0bb976bf2c4ac
GitHub-Pull-Request: golang/tools#202
Reviewed-on: https://go-review.googlesource.com/c/tools/+/218437
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2020-02-07 13:10:02 +00:00
Rob Findley
c29062fe1d internal/lsp: refactor LSP server instantiation
Previously, the process of instantiating and running the LSP server was
sharded across the lsp, protocol, and cmd packages, and this resulted in
some APIs that are hard to work with. For example, it's hard to guess
the difference between lsp.NewClientServer, lsp.NewServer,
protocol.NewServer (which returns a client), and protocol.NewClient
(which returns a server).

This change reorganizes Server instantiation as follows:

 + The lsp.Server is now purely an implementation of the protocol.Server
   interface. It is no longer responsible for installing itself into the
   jsonrpc2 Stream, nor for running itself.

 + A new package 'lsprpc' is added, to implement the logic of binding an
   incoming connection to an LSP server session. This is put in a
   separate package for lack of a clear home: it didn't really
   philosophically belong in any of the lsp, cmd, or protocol packages.
   We can perhaps move it to cmd in the future, but I'd like to keep it
   as a separate package while I develop request forwarding.

   simplified import graph:

    jsonrpc2 ⭠ lsprpc ⭠ cmd
               ⭩           ⭦
            lsp           (t.b.d. client tests)
           ⭩   ⭨
     protocol  source

 + The jsonrpc2 package is extended to have a minimal API for running a
   'StreamServer': something analogous to an HTTP server that listens
   for new connections and delegates to a handler (but we couldn't use
   the word 'Handler' for this delegate as it was already taken).

After these changes, I hope that the concerns of "serving the LSP",
"serving jsonrpc2", and "installing the LSP on jsonrpc2" are more
logically organized, though one legitimate criticism is that the word
'Server' is still heavily overloaded.

This change prepares a subsequent change which hijacks the jsonrpc2
connection when forwarding messages to a shared gopls instance.

To test this change, the following improvements are made:

 + A servertest package is added to make it easier to run a test against
   an in-process jsonrpc2 server. For now, this uses TCP but it could
   easily be modified to use io.Pipe.

 + cmd tests are updated to use the servertest package. Unfortunately it
   wasn't yet possible to eliminate the concept of `remote=internal` in
   favor of just using multiple sessions, because view initialization
   involves calling both `go env` and `packages.Load`, which slow down
   session startup significantly. See also golang.org/issue/35968.

   Instead, the syntax for `-remote=internal` is modified to be
   `-remote=internal@127.0.0.1:12345`.

 + An additional test for request cancellation is added for the
   sessionserver package. This test uncovered a bug: when calling
   Canceller.Cancel, we were using id rather than &id, which resulted in
   incorrect json serialization (as only the pointer receiver implements
   the json.Marshaller interface).

Updates golang/go#34111

Change-Id: I75c219df634348cdf53a9e57839b98588311a9ef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/215742
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-06 23:12:37 +00:00
Rohan Challa
2529d2857a internal/lsp/tests: standardize testdata folder format
This change standardizes the folder structure for testdata that are used for testing the lsp. In particular, it uses the following format:
- dir
  - primarymod
    - .go files
    - packages
    - go.mod (optional)
  - modules
    - repoa
      - mod1
        - .go files
        -  packages
        - go.mod (optional)

As we can see, any folder inside of testdata should be of this format, where the primary test files with the markers are all located inside the primarymod folder. The modules folder is used to hold any potential dependencies that are used for testing.

A consequence of this change is that we can have one directory separated by folders, where each folder is it's own module, this allows us to use internal/lsp/tests with go.mod files. Now, tests.Load() will return an array of Data objects, where each object corresponds to one of the directories structured above.

Updates golang/go#36091

Change-Id: I437cc2a2a9fc1bac93779845737aa74383fbf9c3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/217541
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-02-06 14:14:23 +00:00
Rebecca Stambler
531cc8856e gopls/doc: update VS Code settings to correspond with current defaults
Change-Id: Icf16808af9e476040b034ab5bd31e56fd0c0938e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/218077
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-06 01:06:05 +00:00
Rob Findley
4abfd4a162 gopls/integration/govim: switch to latest, and improve artifacts
Now that there is a tagged version of govim containing the `-gopls` test
flag, we can just use latest to pick up a relatively stable govim, and
not have to maintain the govim version.

Doing this required changing the way we fetch govim into our test
harness: there is now the assumption that /src/govim is a git
repository, so we clone using git.

Along the way, clean up some unnecessary artifacts and add a script for
downloading artifacts from GCS.

Change-Id: I6ef4dd468d6b9baf66d3adae3f1fb80c12ac9578
Reviewed-on: https://go-review.googlesource.com/c/tools/+/217730
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-02-05 14:18:39 +00:00
Hana Kim
174f5c63c9 gopls: add the link to the gopls/README.md
Change-Id: I6113ca988afa7a9d1dc0a865c6981400ac242c9d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/217082
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2020-02-03 22:28:49 +00:00
Ainar Garipov
d33eef8e68 gopls/doc: document updating to an unstable version
Fixes golang/go#36751

Change-Id: Ib5036bcc1f8ee0ab11d9978eea597222e86cc085
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216437
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-25 22:37:03 +00:00
Rob Findley
0a06c69952 gopls/integration/govim: update to latest govim
Govim integration tests are now passing at govim HEAD + gopls HEAD, so
we should be able to start actively investigating any regressions on the
gopls side after this change.

Change-Id: Ibf50d7e42e19cfc80779691e2c42f643028b2e39
Reviewed-on: https://go-review.googlesource.com/c/tools/+/215897
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-01-22 19:49:06 +00:00
Rebecca Stambler
39095c1d17 gopls/internal/hooks: ignore a duplicate analysis from staticcheck
Hardcoded for now. Will need a better approach if more of these come up.

Fixes golang/go#34494

Change-Id: Id442d68fa16d81e747ad5ec951fb6b80fdb65f94
Reviewed-on: https://go-review.googlesource.com/c/tools/+/215118
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-01-17 06:52:30 +00:00
Rebecca Stambler
20e5918576 gopls/doc: improve troubleshooting docs with specifics
Add the exact VS Code settings that users need to capture valuable logs.

Change-Id: If6b4874d1d3beab2fa6da054615dd7973b6e3fa9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214940
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-01-15 20:40:27 +00:00
Damien Lespiau
fdfa0def04 gopls/doc: fix it's/its typo
Change-Id: If8eecf41ae6d83bf4228e818aa1ef9ee3267db58
GitHub-Last-Rev: 73153ddfb8c86a145eef79997b18a5cdef21b8bf
GitHub-Pull-Request: golang/tools#197
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214858
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-15 15:48:44 +00:00
Rob Findley
850357681a gopls/integration/govim: update build steps to capture artifacts
Govim integration tests generate a number of artifacts, including both
the govim and gopls logs, that can be useful in debugging failures. This
change updates our cloud build configuration to capture these artifacts,
along with several other minor improvements.

Notably artifacts are uploaded to GCS as a separate build step, so that
we have the potential to use its granular permission model for sharing
these artifacts. Right now, this requires temporarily swallowing the
exit code of `go test` so that the build can proceed.

Also:
 - Update govim to a newer version; we still can't use latest as there
   isn't a tagged version that contains the requisite flag change.
 - Alter the test harness to run tests from the github.com/govim/govim
   module root.
 - Switch use a major version label when referring to the test harness
   build step, to allow for breaking changes (such as the one made
   here).
 - Add a missing copyright header to run_local.sh.
 - Update run_local.sh to work with the modified harness.
 - Update documentation accordingly.

Change-Id: Ie5ddaf54e775371a36163f98c1beb90c217be931
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214577
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-01-15 14:49:07 +00:00
Rob Findley
e23c44e711 gopls/doc: minor fixes in design.md and implementation.md
A couple sentences are clarified in design.md, and a broken link is
fixed in implementation.md.

Change-Id: Ibbb4c2f74ce9e46c565a7e90798047e7168b076e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214798
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-01-14 23:33:23 +00:00
Koichi Shiraishi
4da8041706 gopls/doc: fix 'Report the issue' bad link
Change-Id: Ie31d1f375ea93840926d23aef5232ccb77b883a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214537
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-01-13 20:22:26 +00:00
Peter Weinberger
81ef4df1d3 gopls/integration: save more precise parsing information
These are changes to treat errors more like responses. They are
important for the forthcoming log viewer.

Change-Id: Ief8de6ecea716673d4aee417de205842ceab4fc8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/213124
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-02 18:22:54 +00:00
Rob Findley
9497f49d57 gopls/integration: cosmetic/ergonomic updates
Some ergonomic and cosmetic updates are made to the integration/replay
and integration/parse packages, following a pass through the code:
 + In the README, a some typos are corrected.
 + A few symbols are renamed:
   - Direction->MsgType, since this type is more than a client-server
     direction
   - logRec->scanLogs, to be more consistent with the naming convention
     SplitFuncs in the bufio package
   - CamelCase is applied in a few places.
 + Context is plumbed through, rather than use a package local ctx.
 + In a few cases, returning an error is preferred over log.Fatal.
 + Some duplicated code is deleted, and types from the parse package are
   reused. (this was probably cruft from the repo migration)
 + The logfile is made an argument rather than a flag to the replay
   tool.

Change-Id: Ie72e6e8a4d7020d8cf708f6791353897791bcc86
Reviewed-on: https://go-review.googlesource.com/c/tools/+/211057
Reviewed-by: Peter Weinberger <pjw@google.com>
2020-01-02 14:09:08 +00:00
Dan Kortschak
6c68fec0bc all: remove many cases of space-space
Change-Id: I49eb8410d4143c67dfccf027f8b2794e66963415
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212580
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-30 19:07:42 +00:00
Rebecca Stambler
6b505debf4 gopls: use mvdan.cc/xurls for textDocument/documentLink
Our current implementation isn't robust, and it doesn't seem worth it to
invest significant effort in improving it when this library exists.

Also, make the protocol part of the default URL regex non-optional, as
the alternative is that any string of the format "foo.bar" will appear
to be a link.

Updates golang/go#33505

Change-Id: Ia430a1c193eded394f8af12050bdd4dc2a9ccc94
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212517
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-26 21:20:25 +00:00
Rebecca Stambler
a7b3459f04 gopls/doc: remove unnecessary settings from VSCode documentation
The EOL setting is no longer needed, as the issue it was correcting
has been fixed. The file watching setting is not really being respected
correctly in the current version of gopls, as we are currently reworking
it.

Change-Id: I0aa9546f0c806bcf326eb83b515bee4bce4c6864
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212497
Reviewed-by: Heschi Kreinick <heschi@google.com>
2019-12-23 18:49:12 +00:00
Rob Findley
d7ab245118 gopls/integration: add a first cut of govim integration tests
Govim has integration tests that we can leverage to help guard gopls
against regressions. Changes have been submitted upstream to facilitate
running these tests against a locally built gopls binary
(https://github.com/govim/govim/pull/629)

This CL adds a Dockerfile to build an image that has a version of govim
available and ready for testing. This is then used to create a custom
build step in a separate Cloud Build configuration, that builds gopls
from source and runs the govim integration tests.

A script (run_local.sh) is also added to facilitate running these tests
locally.

Change-Id: If68eabf9863a1689e29d9d744ff953d94a2b7681
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212018
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-23 18:47:16 +00:00
Jorge L. Fatta
0b43622770 fix: using section links to IDE specific doc
Fix the link to the IDE specific usage documentation (now under /doc/ folder).

Change-Id: Ib0efb8a107195317c7a4a535fc9f624fe277840e
GitHub-Last-Rev: 66f771f799c1e93fd9337040f0b1166061f6419e
GitHub-Pull-Request: golang/tools#192
Reviewed-on: https://go-review.googlesource.com/c/tools/+/211561
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-12-17 14:12:49 +00:00
Ian Cottrell
bbbf87ae26 gopls: add status and roadmap to the main readme.
Change-Id: I5794d1afd0bcddbe3c1a4e2546133df4ce044e2f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/211577
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-12-17 03:36:36 +00:00
Rohan Challa
56463cc14b internal/lsp: create parseModHandle for storing go.mod data
Created an analogous data structure for go.mod files when we parse them
using the golang.org/x/mod package. Gopls can now access the data
within a go.mod file using a parseModHandle and the corresponding
parseModData object. This will help down the road when it is time
to implement the lsp functions for go.mod files.

Updates golang/go#31999

Change-Id: Ibd4d64569bbe3df61b203490b63399d479e7d794
Reviewed-on: https://go-review.googlesource.com/c/tools/+/211303
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-12-13 22:03:54 +00:00
Iskander Sharipov
b1451cf344 gopls/integration: remove commented-out debug code
Change-Id: I824a36f893970588534ec85ade93dfa100d14fe6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/209697
Run-TryBot: Iskander Sharipov <quasilyte@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
2019-12-03 23:32:40 +00:00
Peter Weinberger
c197fd4bf3 gopls/integration: add the replay command to replay LSP logs
Documentation is in replay/README.md

Change-Id: Ic5a2b59269d640747a9fea7bb99fb74b2d069111
Reviewed-on: https://go-review.googlesource.com/c/tools/+/209577
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-12-03 13:40:12 +00:00
Jędrzej Szczepaniak
6e064ea0cf internal/lsp: link to the new pkg.go.dev instead of godoc.org
Updates golang/go#35563

Change-Id: I88ae3f742daf5043d4784fe8827454fb1ce1f9db
Reviewed-on: https://go-review.googlesource.com/c/tools/+/209337
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-30 07:06:09 +00:00
Rebecca Stambler
724660f1af gopls/doc: add documentation for gopls with Atom
Change-Id: Ia2e8913c8ff8d7da3061344f2d4e98bab7b4fbd7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/209097
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-11-27 06:49:51 +00:00
Rebecca Stambler
d7101b74a4 internal/lsp: set version correctly after textDocument/didOpen
The early return logic for didOpen events in
(*snapshot).invalidateContent was preventing the creation of a new
snapshot, which was in turn stopping the versions from being updated.

This exposed a fundamental issue in the way we were calculating
workspace diagnostics. Since we weren't waiting for diagnostics to be
completed for an entire snapshot before replying that the server had
been initialized, snapshots were being cloned without any type
information. For quickfix code actions, we assume that we have all
information cached (since we need to have sent the diagnostics that the
quickfix is mapped to), so we were not finding the cached analysis
results.

To handle this in the short-term, we key analyses by their names, and
then regenerate results as-needed for code actions. This is technically
more correct than simply assuming that we have the analyses cached. In a
follow-up CL, I will send a follow-up that will make sure that
snapshots "wait" on each other to be fully constructed before being
cloned.

Change-Id: Ie89fcdb438b6b8b675f87335561bf47b768641ac
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208265
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2019-11-25 19:35:51 +00:00
Muir Manders
aa38f8e97a gopls/doc: expand Emacs docs
- expand starter config to be more self-contained
- add section for gopls config settings

Change-Id: I9b2468acd90dff2d0469aa16ce715033eed4973b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/206798
Run-TryBot: Muir Manders <muir@mnd.rs>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-11-12 19:56:55 +00:00
Ian Cottrell
f79515f338 gopls: control features for command line tests
A general mechanism for modifying the features in command line tests
Use it to turn of go-diff for now

Fixes golang/go#35392

Change-Id: Ie79723e94fb14fcde1e98709a63f44046e101bc4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/205739
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-07 01:09:34 +00:00
Josa Gesell
80f3f9ca08 Fix header level in settings.md
Change-Id: Ic4ecd583ce62e624dad568f9c421a87e4d222fd4
GitHub-Last-Rev: 0a4f186beb7774134bd7e400c90b4dd6e129a899
GitHub-Pull-Request: golang/tools#180
Reviewed-on: https://go-review.googlesource.com/c/tools/+/203157
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-28 21:55:54 +00:00
Rebecca Stambler
fc4ffaa1ce gopls: update go.mod file
It's been a while since we updated, and this will make things easier for
users who want to try new features.

Change-Id: I3accd77e23bf2d0bbafaba16dcab8179e6a14253
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201638
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-21 18:45:54 +00:00
Ainar Garipov
846f856e7d gopls/doc: fix issue links for vim-lsc
Change-Id: Iecdc087da7e48a170616e0453c5c4fe1a45ef95e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201419
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-17 10:18:17 +00:00
Shengjing Zhu
5fa5b1782b gopls/doc: instructions for adding settings in coc.nvim
Change-Id: I7d69477cc103e8e45b0e9394e32945a0d8ee19b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200868
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-14 14:15:50 +00:00
Ian Cottrell
5889748991 internal/lsp: use options hooks to install diff driver
Change-Id: I2f94c2a68d0036a47ccac3fce07cf9f3b784d443
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200558
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 16:38:31 +00:00
Ian Cottrell
a26de0c301 gopls: use go-diff for edit generation
this supports sub-line diffs and is much faster

Fixes golang/go#33003
Fixes golang/go#32586
Updates golang/go#31937

Change-Id: I02f82c75828e7e3ec804e8beee916893d4c14b3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/191018
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:18:25 +00:00
Panos Georgiadis
83b12cb08e Fix vscode config to watch file changes
Fix the documentation by using the correct configuration for
watching file changes outside of the editor.

Fixes https://github.com/microsoft/vscode-go/issues/2810

Change-Id: Ib550d9831fe4563ceb5917d9196b201a03b051d2
GitHub-Last-Rev: 86c49abed8a0c79b641e02a23128b4654d2d6d48
GitHub-Pull-Request: golang/tools#169
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199578
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-07 17:02:13 +00:00
Fazlul Shahriar
8a18b87bf6 all: fix broken links to LSP specification
Change-Id: Ied2cfa57012a8ec3c8bdd03a97fa7fc8bc744be9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198381
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-02 18:32:53 +00:00
Ian Cottrell
6816ec868d gopls: refactor the cmd tests
This allows them to be run from the gopls module as well to test
the code with the hooks installed.

Change-Id: I3079a04ffe3bd221ccc2523e746cbed384e05e2f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196321
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-23 22:12:42 +00:00
Rebecca Stambler
59c6680fe2 gopls/doc: fix typo in settings
Change-Id: Ia504ebccae77db5533c8a29a455f074068db78b4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196663
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-23 18:36:22 +00:00
Ian Cottrell
71c3ad9cb7 gopls: adding static check to the new gopls module
Change-Id: Ic07741211632edb2d808f0e5fd213da3dfef5676
Reviewed-on: https://go-review.googlesource.com/c/tools/+/182179
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-23 16:54:24 +00:00
Ian Cottrell
c426260dee gopls: add a hooks package
This allows us to hook functionality from the main tools repository with
alternate or extended implementations.

Change-Id: Ibc66cdd15ee80f1104a8464f1e28763a41d5765a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196319
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-20 02:37:04 +00:00
Rebecca Stambler
58d531046a gopls: update go.mod for v0.1.7
Change-Id: I8953ba567b7aecb664a093acd5a91370a6e1fde9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196280
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-09-18 21:49:20 +00:00
Matt Layher
bbfbbc9265 gopls/doc: add instructions for VSCode remote development
Change-Id: I0a7e9feea556e21b2feb0540136f957de98526c0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195981
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 20:28:04 +00:00
Rebecca Stambler
3512ebf574 gopls: update go.mod
Change-Id: Ie42b99e23d94d8a5f745cbfb81d943f7a4d73867
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195657
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 17:33:50 +00:00
Ainar Garipov
1ccc110ba9 gopls/doc/vim.md: enable suppress_stderr for natebosch/vim-lsc
By default, github.com/natebosch/vim-lsc shows messages from stderr in
vim's :messages, which may cause problems and is generally annoying.
Suggest disabling that by setting suppress_stderr to v:true.

Change-Id: If997b8f8fd036a1ac08ba74a3886f33ff71413c2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194137
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 02:06:55 +00:00
Rebecca Stambler
96954830e1 gopls/doc: add and make minor changes to documentation
Change-Id: Ibb7d7715541ee2a712dd6927abceadc45ec60b41
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195517
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 01:38:12 +00:00
Daniel Cormier
44811c0174 Fixed documentation for gopls installation
Fixes this problem when trying to use the documented installation command:

```
$ GO111MODULE=on go get golang.org/x/tools gopls@latest
go: finding golang.org/x/tools latest
go: downloading golang.org/x/tools v0.0.0-20190911230505-6bfd74cf029c
go: extracting golang.org/x/tools v0.0.0-20190911230505-6bfd74cf029c
go get gopls@latest: malformed module path "gopls": missing dot in first path element
```

Change-Id: Ifdd13ec85eca5a069c17ae89486efe1abf4016f4
GitHub-Last-Rev: a4ddc02e3b8e6ccce12dfa711a8e7af5edb1302c
GitHub-Pull-Request: golang/tools#158
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195037
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-12 13:20:05 +00:00
Rebecca Stambler
6bfd74cf02 internal/lsp: update go.mod for next version
Change-Id: Ic2e437f7daec94f648ba1a13e99a9ada462cdf49
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194897
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2019-09-11 23:05:05 +00:00
Rebecca Stambler
63a3583f64 gopls/doc: update config settings in documentation
Change-Id: Ieef4c541fdc48afc5b6064b7057edab3a28fefb0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194686
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-11 20:22:09 +00:00
Rebecca Stambler
b87a5f9d55 internal/lsp: update gopls mod file
Change-Id: I029c690d1797b12af186fd6e445d15d3c5a27412
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194685
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-11 19:57:40 +00:00
Ainar Garipov
feee8acb39 all: fix more typos
Change-Id: I978ad5e1800ebfceb78aaced438331a8341715d4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194697
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-11 15:13:14 +00:00
Rebecca Stambler
0673112484 internal/lsp: update to latest version of x/tools
The fix for golang/go#29313 just went in, so update so people can fetch
it more easily.

Change-Id: I60fda011dfdd62d5de429834a6692f6b21074f0d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194377
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-09 21:46:02 +00:00
Rebecca Stambler
a4fdb3a8b2 gopls: update x/tools version
Change-Id: Ibf3c3381a3ecb3015b44436b7e28b615fab00bf4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/193378
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-04 21:13:25 +00:00
Karthik Nayak
a56fc290d6 gopls: fix typo in the design document
Change-Id: I0ae8f7c9c02660111236ba88eba8faa69a974ab8
GitHub-Last-Rev: d428dbf26672646c4d25ded71e47a710279a8444
GitHub-Pull-Request: golang/tools#149
Reviewed-on: https://go-review.googlesource.com/c/tools/+/192898
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-03 01:11:30 +00:00
Ian Cottrell
062dbaebb6 cmd/gopls: add documentation
Much of this documentation has been collated from other sources,
but this pulls it all into one coherent and public structure in
a way that allows us to peer review changes.

Change-Id: Ic24a59bb92b27ec85d2f57affcf2eb396c9de3c0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/191741
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-08-27 15:23:08 +00:00