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

3707 Commits

Author SHA1 Message Date
Heschi Kreinick
68f92b6635 go/packages: remove go.mod files
Files named go.mod define a module boundary and punch a hole in the
repository when the module is fetched with go get. We had a couple in
testdata. Get rid of them.

In one case the changes I made to produce a module cache in packagestest
were enough. In the other, the test needs multiple minor/patch versions
of the same module, which we have no provision for. Rename them to
"definitelynot_go.mod" in the repo and fix it up in the test.

Updates golang/go#34352

Change-Id: I284578b3aebb0f1fec3ddb4bef0df24f050d0636
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196258
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-18 20:53:24 +00:00
Rebecca Stambler
9098376d50 internal/lsp: change names used by per-folder configs
This was causing microsoft/vscode-go#2749, which was a result of users
having folders named "go", and VSCode-Go returning the "go"
configuration settings (which are all of its settings, not those of
gopls).

Change-Id: Ifbde3e32ad2de79265ed6adea53588c730ecd716
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196197
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-18 20:53:03 +00:00
Michael Matloob
567d1c21dc go/packages: fix a small spelling mistake
Change-Id: I06478ae275c25c2acfc26875a175799ed2507f65
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195066
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-18 20:39:58 +00:00
Heschi Kreinick
c886270503 internal/imports: don't prefix stdlib package with std/
When running in GOROOT/src, `go list -m all` shows the std package (or
cmd package) as the main module. This confuses goimports into adding
std/ or cmd/ at the beginning of import paths. Skip canonicalization for
paths under GOROOT.

Fixes golang/go#31814

Change-Id: Iff5cc7e2a2053e4cc87c1a579a4c47d856cd0a2e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195063
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-18 19:29:07 +00:00
Rebecca Stambler
2c18af7e64 internal/lsp: ensure that an AST cannot be nil without an error
Fixes golang/go#34366

Change-Id: I2f5269cd0b270aef5accc69adeced8be4523cb65
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196142
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-18 18:10:22 +00:00
Muir Manders
3d643c64ae internal/lsp: add literal completion candidates
Add support for literal completion candidates such as "[]int{}" or
"make([]int, 0)". We support both named and unnamed types. I used the
existing type matching logic, so, for example, if the expected type is
an interface, we will suggest literal candidates that implement the
interface.

The literal candidates have a lower score than normal matching
candidates, so they shouldn't be disruptive in cases where you don't
want a literal candidate.

This commit adds support for slice, array, struct, map, and channel
literal candidates since they are pretty similar. Functions will be
supported in a subsequent commit.

I also added support for setting a snippet's final tab stop. This is
useful if you want the cursor to end up somewhere other than the
character after the snippet.

Change-Id: Id3b74260fff4d61703989b422267021b00cec005
Reviewed-on: https://go-review.googlesource.com/c/tools/+/193698
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-18 17:13:17 +00:00
Johan Brandhorst
f45d5df211 internal/lsp/source: add sortslice analyzer
The sortslice analyzer warns the user when they're
using a non-slice parameter to sort.Slice. It can
also suggest fixes for 3 different cases of misuse:
  1. The parameter is a pointer to a slice.
  2. The parameter is an array
  3. The parameter is a function with no arguments
    that returns a slice.

Change-Id: If6327b19ab3c476cf17ca3c5fd75bc43bb8683e9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195898
Run-TryBot: Johan Brandhorst <johan.brandhorst@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-18 16:24:38 +00:00
Rebecca Stambler
905c8ffbfa internal/lsp: fix diagnostics to report for all available files
Change-Id: Ie613161eb8444b5884733f0b6916b2f1971a4743
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196025
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 21:50:24 +00:00
Rebecca Stambler
11affa06ff internal/lsp: show errors when the user is in the wrong directory
If we encounter `go list` errors when loading a user's package, we
should try to see if they've encountered any of our common error cases.
They are: 1) a user has GO111MODULE=off, but is outside of their GOPATH,
and 2) a user is in module mode but doesn't have a go.mod file.

Fortunately, go/packages does a great job handling edge cases so gopls
will work well for most of them. The main issue will be unresolved
imports. These show up in DepErrors in `go list`, so go/packages doesn't
propagate them through to the list of errors. This will require changes
to go/packages.

Updates golang/go#31668

Change-Id: Ibd5253b33b38caffeaad54a403c74c0b861fcc14
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194018
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 21:41:55 +00:00
Rebecca Stambler
1cc9451822 internal/lsp: distinguish parse errors from actual errors
Parse errors need to be treated separately from actual errors when
parsing a file. Parse errors are treated more like values, whereas
actual errors should not be propagated to the user. This enables us to
delete some of the special handling for context.Canceled errors.

Change-Id: I93a02f22b3f54beccbd6bcf26f04bb8da0202c25
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195997
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 21:21:32 +00:00
Rebecca Stambler
d997db1b28 internal/lsp: return errors from diagnostics
Also, we were repeating the same code for diagnostics in 4 places.
Extract into a function.

Change-Id: I18d00e512a67679b915347a61126970cf02a7a4a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196019
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 21:08:37 +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
3b4f30a44f internal/lsp: remove helpers for getting packages
We had too many options for functions to use to get type information for
a package. Now we stick with having one option to get the check package
handles, and then the caller can refine the results as needed.

Change-Id: I81f69a670e1539854ee23b6f364159a7de9b782f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194457
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 16:23:42 +00:00
Rebecca Stambler
c52e9e2de4 internal/lsp: fix vet errors
Change-Id: I2435140e7b2b419df704e994ec45ad75932421b1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195877
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 16:21:16 +00:00
Than McIntosh
6c790d6458 go/internal/gccgoimporter: update package to match std lib version
Import changes from std lib version, specifically

   https://golang.org/cl/194565
   https://golang.org/cl/194440

related to handling of embedded fields in pointer loops.

Change-Id: I7218e39d67ada728accd707b11fced6ed52f5fa2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195958
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-17 14:45:18 +00:00
Ian Cottrell
11bbd741f5 internal/memoize: changes to only one handle per key
This is to remove the confusion around having only handles that have had Get
called pin the value into memory.
Instead now there is a single handle per key, and it is the handle that is
weakly held not the value.

Change-Id: I9e813a0dfe2adf4cb651af9b5cfc8878fa71c041
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186839
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-17 14:40:27 +00:00
Rebecca Stambler
2dc213d980 internal/lsp: remove cachedFileToMapper function
This function incorrectly used cached packages to get ASTs and type
information that should have been directly found from the origin
package. Shift to using pkg.FindFile instead.

Change-Id: I9f73209bb1a1343f53b430150e78ffd180e14a44
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195797
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-17 03:27:47 +00:00
Muir Manders
5999de1043 internal/lsp: tighten up completion budget check
Tweak a couple things to improve how we reduce our search scope based
on remaining time budget:

- Check our budget on the first candidate rather than waiting for the
  1000th candidate. If type checking is slow you can be out of budget
  before you even begin.
- Reduce our budget check interval from 1000 candidates to 100
  candidates. This just helps us adjust our search scope faster.

The first tweak required me to raise the completion budget for tests
because 100ms is not always enough. I moved the budget into the
completion options so that tests can raise it.

Change-Id: I1aa7909d7baf9c998bc830c960dc579eb33db12a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195419
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-17 02:32:08 +00:00
Muir Manders
bb199b9d33 internal/lsp: reduce completion candidate volume
Revert my previous change to include fuzzy matches with a score of
zero. Zero scorers have some characters that match, but they are
pretty poor overall. Pulling in all the extra junk candidates was
slowing things down in certain cases.

Change-Id: I560f46903281f21b0628c9b14848cddf1e3c0a38
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195418
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-17 02:23:53 +00:00
Rebecca Stambler
fff8d94173 internal/lsp: use ParseGoHandles for the builtin package
This change allows to remove some of the special handling for the
builtin package.

Change-Id: I105fcefd8812af2d42ff42edca954824c98db429
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195758
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 23:04:25 +00:00
Rebecca Stambler
5edc6aefed internal/lsp: reduce usage of column mapper
A mapper is always uniquely tied to a file at a specific version, so
just build it when we get a new *ast.File. We build the mapper using the
*token.File associated with the particular *ast.File, which is why there
is one per ParseGoHandle instead of FileHandle.

Change-Id: Ida40981ef91f6133cdd07e9793337fcd67510fba
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194517
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 22:00:07 +00:00
Muir Manders
b31ee645dd internal/lsp: avoid unnecessary type checking
Previously we would type check all package handles as we fetched them.
This meant if you only cared about a file's primary package you would
still have to wait for all its packages to be type checked. For
example, when completing in foo.go, you would wait for [foo.go] and
[foo.go, foo_test.go] to be checked (the latter being the test
variant).

Now we don't type check packages as we put together the package
handles.

Change-Id: Ibca0c6b34cf4f0a07bcdeb62959d60158f4ccf17
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195417
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-16 20:14:40 +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
Rebecca Stambler
cb62a53de3 internal/lsp/debug: bump version number for release
Change-Id: I6626e807cb947292d82ffba6c93c8f0c55247328
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195621
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 17:20:13 +00:00
Rebecca Stambler
64a767472a internal/span: handle escaping file URIs
I wasn't sure if we should just manually construct the URI here or use
the URL unescaping function. Let me know which you think is best.

Updates golang/go#34270

Change-Id: Idb48fc2650d39f3e54cac141a70f356c31e303ad
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195618
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 17:14:20 +00:00
pjw
e45ffcd953 internal/lsp.protocol: identify the version of the LSP that code is generated for
Changes go.ts to check that the commit hash of the vscode is the one that it
is expecting. README.md now contains more explanation.

Change-Id: Ia5a947c6d5d026c2b7d9ab18877c320e8a7f45d2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195438
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 13:03:36 +00:00
Rebecca Stambler
92af9d69ef internal/lsp: handle potential nil pointer
Change-Id: I345b0d22053248f875683d87515d9e7c5e1d16c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195518
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-09-16 03:47:16 +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
Muir Manders
f3d05f808b internal/lsp: fix error formatting directive
protocol.Position doesn't implement String(), so don't use "%s"
formatting directive. We could implement String(), but it is generated
code, so its a bit iffy.

Change-Id: If21b5fee66c6e1bd59f19b520c7d36f0e648cb71
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195042
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-16 01:55:42 +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
Muir Manders
1d8cfc4bd2 internal/lsp: omit "iota" completion outside const decls
Add a special check to skip builtin "iota" candidate outside of const
declarations.

Change-Id: I767c012585dfc51b4c07cf5847d3b4083a4a2a7b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195044
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-15 20:16:06 +00:00
Johan Brandhorst
31e00f45c2 go/analysis: add sortslice pass
The sort.Slice method accepts an empty interface as its first
argument, but a slice type is the only valid use of the method.
This analyzer adds a diagnostic if the user uses the sort.Slice
method with anything other than a slice type as the first argument.

Change-Id: I3b54873faba2e9c2e832223a3cdab15a0b534650
Reviewed-on: https://go-review.googlesource.com/c/tools/+/191598
Run-TryBot: Johan Brandhorst <johan.brandhorst@gmail.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-09-14 23:59:51 +00:00
Peter Weinberger
0240832f5c internal/lsp/protocol: bring the typescript code up to date
These versions of go.ts and requests.ts generate tsprotocol.go,
tsserver.go, and tsclient.go. README.md now gives the version of the
vscode source used, showing that the typescript code and tsprotocol.go
are matched to the same git commit of vscode.

Many of the diffs are just whitespace from vscode's formatting.

Fixes golang/go#34225

Change-Id: Ib66dad9476b452f332a4c0e990faf2c6060a588e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195297
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-13 18:13:37 +00:00
Michael Matloob
3720d1ec36 go/packages: suppress go list -e error when directory outside modules
If an absolute directory path being listed is outside any modules,
go list -e returns a non-zero exit status and non-empty stderr, but
should suppress the error. This was causing a weird bug when golang.org/cl/186337
was submitted because that changed the conditions when -export was passed,
which in turn affected how we suppressed the go list -e error (because
-export causes a compile it overtriggers errors, so we explicitly
suppress errors in that case). The way the error was being suppressed,
no error was generated, and no fake package was generated (which go list
is supposed to do), so the contains query fallback code wasn't run.

Fixes golang/go#34265
Updates golang/go#34273

Change-Id: I1213cff0e03a62c6976e50db5b2d805aa3ddbb7a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195065
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-12 21:56:17 +00:00
Rebecca Stambler
87d9f09c5d internal/lsp: turn fuzzy matching and deep completions back on
We turned them off for the release, but let's keep them on at master so
that we can get more feedback.

Change-Id: Iaadf27d59ef925ba8ee2bc02acbb9c77c2935ce2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195059
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-12 18:56:36 +00:00
Rebecca Stambler
b0a6c2aa3f internal/testenv: handle GOPACKAGESDRIVER=off in NeedsGopackage
This was causing tests to report that they required a binary
called "off".

Change-Id: I592109029c86af20d48d2ee9989d4a25fdb11b3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194978
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-09-12 15:29:09 +00:00
Michael Matloob
22c3443cad go/packages: fall back to loading from export data if sources are missing
When a user asks Syntax or TypesInfo, we need to typecheck from sources.
If the sources are missing fall back to trying to load from export data,
but still report an error.
This will help in some cases where the driver has incomplete data.

Change-Id: I3b23e90a5cd865c5f729e50f09f5fadff2d32994
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194683
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-12 15:29:02 +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
c7d52e45e2 internal/lsp: use the view options, not the session options
Previous changes to the config mechanism made the config options
per-view, not per-session. We should now make sure to obey config
changes per-view. This does not fix the configuration handling for
"watchChangedFile" however. This should be done in a future CL.

Change-Id: I73f6236386c36d2587fdb9c0601670833a4366c3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194818
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2019-09-11 22:59:40 +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
Denis Isaev
7dd31af5a6 go/packages: allow types loading without NeedDeps
Before separating Load* into Need* we could use LoadSyntax
to get types information by loading inital packages
from source code and loading it's direct dependencies from export data.
It was broken when separation was introduced and before this commit
everything was loading from source code what resulted into slow
loading times. This commit fixes it.

Also, do backwards-incompatible fix of definition of deprecated
LoadImports and LoadAllSyntax.

Improve an internal error message
"internal error: nil Pkg importing x from y": replace it with
"internal error: package x without types was imported from y".

Remove packages.NeedDeps request for loading in tests
TestLoadTypesBits and TestContainsOverlayXTest.

Fixes golang/go#31752, fixes golang/go#33077, fixes golang/go#32814,
          fixes golang/go#31699, fixes golang/go#31930

Change-Id: I416e3c1035d555d67039e45a4fdd1deb9b2184ef
GitHub-Last-Rev: 2e3a46e6572d100ace486af33dcde45288cced46
GitHub-Pull-Request: golang/tools#139
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186337
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-09-11 20:03:32 +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
Rebecca Stambler
b13fa046aa internal/lsp: merge session and view options into one
This fixes the issue of config options not being applied.
Also, handle config errors and deprecation by showing a message to the
user.

Change-Id: I850d5303a7a1e301c97324060a87929710ee6700
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194682
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-11 19:36:49 +00:00
Rebecca Stambler
4f2ddba30a internal/lsp: prepare for tagged version
This change temporarily disables fuzzy matching and deep completion by
default, leaving them opt-in for the tagged versions. These will be
re-enabled after the tag on master to continue iterating on them.

Also, update the hard-coded version string.

Change-Id: I0aa688ce067abfe8ae8ebe52a25c8514ec2c7e48
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194777
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-11 17:42:33 +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
Jeremy Faller
663385e6ef cmd/compilebench: add more linker benchmarking
Change-Id: I84ac9637b9d4221f38acbd2bfe8e1d1fc3097f48
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194680
Run-TryBot: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-09-11 14:31:56 +00:00
Ian Cottrell
16c5e0f7d1 internal/lsp: process configuration options more thoroughly
Change-Id: Ic3e2f948f857c697564fa6ab02008444dd9392c7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194458
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-09-11 02:21:29 +00:00
Rebecca Stambler
c9a5ac55f0 go/packages: add a test case for golang/go#33374
Change-Id: Iea94f3fd4ec2faa67a26176250e20f98d693f91d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/192260
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-09-10 23:27:45 +00:00
Rebecca Stambler
ec76318e79 internal/lsp: treat completion documentation errors as actual errors
Also, handle *ast.StarExpr in the identifier code. This fixes a specific
case with deep completions and documentation.

Change-Id: I630ae4e8f1c123ba1fdea85e6862ae93396e2cd4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194564
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-10 23:05:03 +00:00